[ASK]Cara Redirect http non www dan www ke https www


Status
Not open for further replies.

blogger

Poster 1.0
Halo para mastah coding, mau tanya nih: gimana setting htaccess untuk redirect http non www dan www ke https www pada theme phpld directory ? Terimakasih sebelumnya
 

khairilgunawan

Expert 2.0
Verified Provider
Kalau pakai Cloudflare disarankan pakai ini agar tidak error:
Code:
RewriteEngine On
# memastikan web diakses dengan www.
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# memastikan web diakses dengan https
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
 
Status
Not open for further replies.


Top