Question

I have Friendly URLs enabled on my prestashop site. But it works somewhat incorrectly.

All links work fine without WWW in front of them.

But if you add WWW all the internal links (all links except index page) redirect to 404.

For example consider this link:

http://gymrat.ru/7-velotrenazhery

works fine, but if we add WWW in front of it

http://www.gymrat.ru/7-velotrenazhery

it shows 404 error code...

I am using Prestashop 1.5. How can I change my .htaccess file accordingly?

Many thanks in advance!

Was it helpful?

Solution

Add in your .htaccess:

<IfModule mod_rewrite.c>
RewriteEngine on    
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
</IfModule>

at the beginning of the file, before the # ~~start~~ row.

and set your domain name as www.gymrat.ru at BackOffice > Preferences > SEO & URLs

The opposite variant (WWW to NON-WWW) is the following:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</IfModule>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top