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)
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
?
What's a Magento 301 redirect? In essence, Magento 301 redirect is a way to forward bots and web visitors to the new URL. At the same time, the indexes of the old URL’s address will be deleted, and its link equity will be passed to the newly redirected page.
Besides, we will go through steps by steps how to properly change a Magento 2 website’s URL (without 404 error on admin or any pages). Go to your Magento 2 backend: Stores > Settings > Configuration. On the left menu, under General section, you click Web. Expand Base URLs section. Enter the unsecure (http) Base URL for your Magento website.
In your Magento 2 backend, move to Stores > Settings > Configuration. At the left menu, under General section, click Web. Expand Base URLs (Secure) section. To use a secure (https) for the storefront, enter the Secure Base URL, followed by a forward slash (“/”).
In fact, SEO Redirect is a minor feature of Mageplaza’s SEO solution for Magento 2 stores. Along with its ability to manage and handle 301 and 302 redirects, this module comes with a wide range of other outstanding features focusing on improving SEO performance. The bottom line!
Try changing the last line to this:
RewriteRule .* index.php [R=301,L]
See Apache mod_rewrite RewriteRule Directive the section about flags.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With