Magento redirects to base url using 302, how do I get it to use 301

Bogdan picture Bogdan · Sep 7, 2012 · Viewed 14.5k times · Source

I've notice in firebug that the non-www version of my magento store redirects to the www version using 302. For SEO purposes I want it to redirect using 301.

How I tried to fix it

I went to the System > Configuration > General > Web > Url Options and my setting Redirect to Base URL if requested URL doesn't match it is set to Yes (there are only 2 options: Yes or No)Magento 1.4 URL Rewrite options

Imporantant notes

I'm using Magento v1.4.0.1 My .htaccess file contains the following, in regards to URL Rewrites:

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule .* index.php [L]
</IfModule>

How can I change the redirect method to 301?

Answer

Louis B. picture Louis B. · May 15, 2013

As of 1.6.2.0 there seems to be an option to select the redirect method in the Admin Panel, no need to modify the .htaccess.

Simply go to System -> Configuration -> Web -> Url Options and set Auto-redirect to Base URL to your preferred method.