Example of working .htaccess for HTTPS

Permalink
Just FYI, my working .htaccess for HTTPS redirect:
# -- concrete5 urls start --
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME}/index.html !-f
    RewriteCond %{REQUEST_FILENAME}/index.php !-f
    RewriteRule . index.php [L]
</IfModule>
# -- concrete5 urls end --

My hosting provider told me to add these 2 lines to the C5 generated file:
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

I've also set Canonical URL in the dashboard to
https:// MY-SITE.com

linuxoid
View Replies: