Prestashop: Stop subdomains from keep redirecting to main domain

Source: https://www.prestashop.com/forums/topic/635858-2nd-store-redirects-to-main-store-multistore-redirection-problem/?tab=comments#comment-2634035

After installing prestashop, created subdomains don’t work properly due to the .htaccess rewrite conditions automatically created by prestashop.

Add the following right at the end to solve this issue

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

//////////////////

some additional ones to try in case doesn’t work

Source: https://www.prestashop.com/forums/topic/635858-2nd-store-redirects-to-main-store-multistore-redirection-problem/?tab=comments#comment-3116242

#First condition, If is HTTPS without wwww, redirects to www.
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

#Second condition, If is not HTTPS and without www, redirects to HTTPS with WWW.
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*) https://www.%{SERVER_NAME}/$1 [R,L]

#Third, If is not HTTPS and have www, redirects only to HTTPS
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R,L]

This entry was posted in troubleshoot and tagged , . Bookmark the permalink.