I have website where all links http://example.com/PRODUCTPAGE redirect to http://www.example.com

It´s always missing the path after the domain name in my case the productpage.

I know this is partly SEO wise but I´m wondering besides the SEO effect if changing this in my .htaccess would have any effect on other functionality from Magento?

If needed I can paste my .htacess but I have not changed anything really and I´m mostly wondering what would change.


I think this would work fine for you as of my understanding without having any issues regarding Magento:

1) Open the .htaccess file and locate the "RewriteEngine on" line and right after it add the following lines:

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

Once you do this, save the .htaccess file and log in to the Magento admin.

2) Go to the System > Configuration and from the left panel click the "Web" button.

Unfold the "Unsecured" set of options and change the "Base URL" option from http://example.com to http://www.example.com.

Save the changes and your Magento website will be running with www.example.com only!

  • What is mean $1 in URL @Klettseb – Gem Dec 10 '18 at 5:38
  • 1
    $1 refers to the first group caught by your regex (ie between parenthesis). In your case it refers to : ([a-z0-9/-]+) For the URL mypage.html, $1 will contain "mypage", and the rule will redirect to mypage.php – Klettseb Dec 11 '18 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy