cancel
Showing results for 
Search instead for 
Did you mean: 

HTaccess and re-direct to HTTPS

HTaccess and re-direct to HTTPS

Hi, 

 

I have set up a magento site with .uk/.US/.de sub domains. And I am trying to re-direct each to HTTPS, as I have also installed a SSL. 

 

I want to use HTAccess, but everytime I upload a solution to HTTP the website crashes,. 

 

My HTaccess file has got other elements in it, so I understand if it is difficult to work out where I might have gone wrong, but this is what I have inserted for the re-directs.

 

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^$ https://%{HTTP_HOST} [L,R]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^de.mywebsite.com [NC]
RewriteRule ^(.*)$ https://de.mywebsite/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^us.mywebsite.com [NC]
RewriteRule ^(.*)$ https://us.mywebsite.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^uk.mywebsite.com [NC]
RewriteRule ^(.*)$ https://uk.mywebsite.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^de.mywebsite.com
RewriteRule ^ - [E=MAGE_RUN_CODE:de]
RewriteCond %{HTTP_HOST} ^us.mywebsite.com
RewriteRule ^ - [E=MAGE_RUN_CODE:us]

 

Many thanks in advance.

1 REPLY

Re: HTaccess and re-direct to HTTPS

Why don't you just set all Unsecure Base URL to HTTPS instead so everything will be running with HTTPS without the need for any redirects? 

James Lee | Moderator • Magento Master
See My Recommended Magento Hosting & Security Tips