Magento 1.9 – How to Redirect Multiple URLs to HTTPS Using .htaccess

.htaccessmagento-1.9redirect

I'm sure this is simple, but I can't quite work it out.

My Magento website has several (duplicate) URL's:

http://www.example.com
http://www.example.com/index.php/  
https://www.example.com/
https://www.example.com/index.php

I want them all linking to the https version of example.com

I tried adding the following in my htaccess root file:

RewriteEngine On
RewriteCond %{HTTPS} !^on$
RewriteRule (.*) https://www.example.com/$1 [R,L]

RewriteCond %{THE_REQUEST} ^.*/index.php 
RewriteRule ^(.*)index.php$ https://www.example.com/$1 [R=301,L]

but it doesn't work (it means I can no longer access my www.example.com/admin site). Any ideas? I'm sure this must be a common thing with Magento?

Best Answer

No need to change anything in .htaccess file. Please revert back to it's original.

Go to system > configuration > web > secure and set your secure url (with https). Make sure you add "/" at the end of your url (https://www.example.com/index.php/).

Then set Use Secure URLs in Frontend to Yes

Clean your cache and you are done.

If you want to remove index.php from your site, then read this.

Related Topic