Hi,
Just a question I've got for the webstore I'm running (lornahsports). It was set up initialy by a company we work together with. I'm doubting about some settings: URL options > Auto-redirect to Base URL > Set to Yes, 302 found. I've read a lot about this online but don't know what fits our situation the best. Is a 301 redirect not better to use?
We've got a multi storeview shop, based on GEO location and different languages.
As well within these setting the option about store URL's: Add Store Code to Urls, it's set Yes.
What do you recommend?
Kind regards,
Dennis Wiemann
dennis@wiemann.nl
Hi Lornahsports,
I am not a SEO expert, but would like you to see this post by Yoast: https://yoast.com/articles/magento-seo/
Look at section 1.1.1. - there Yoast writes more about 301 vs. 302 redirects.
Hope this helps you further.
I believe when you use redirect to base url in Magento you will have an issue with getting redirected to the homepage if the wrong base url is provided... IE if your using "www.example.com" and someone links to a product on "example.com/sample.html" you will have an issue:
"example.com/sample.html" will be redirected to "www.example.com" instead of "www.example.com/sample.html".
Because of this behavior, I would set redirect to base URL to "no". If you do use redirect to base url, than ensure every single one of your pages has a canonical tag, and have it set to 302 (temporary/may change) instead of 301 (permanent). With a 301 your saying "example.com/sample.html" was permanently moved to "www.example.com". With 302 your still giving a temporary that is incorrect, as the content didn't move there.
I would instead use something like these lines in your htaccess to redirect to www. Just make sure when navigating the site your not linking to non-www versions
############################################
## enable rewrites
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]