View Single Post
Old 10-20-2023, 06:35 AM  
JustBiz
Confirmed User
 
JustBiz's Avatar
 
Industry Role:
Join Date: Jun 2019
Posts: 2,113
Seen plenty slight variations to use in htaccess. These work ok for me.

Code:
# ensure www
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# ensure https
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
JustBiz is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote