mardi 28 avril 2015

.htaccess 301 redirect not working correctly. Need to force HTTPS

We would like to force all requests to our website to use the HTTPS protocol. We just want to replace the protocol of the URL, the rest of the URI can stay the same. Everything works when we start browsing through the website from the homepage. When we open any other page that isn't the homepage first (i.e. http://ift.tt/1DxonF6) we don't get redirected to use HTTPS. What do I need to change on my htaccess file to accomplish this?

This works (it inserts https): ourdomain.com

This doesn't work: http://ift.tt/1DxonF6

Thanks!

htaccess code:

RewriteEngine On
RewriteBase /

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Aucun commentaire:

Enregistrer un commentaire