I have enabled Add Store Code to Urls
to access the different store views of my Magento website, but now www.domain.com
and www.domain.com/en/
have the same content. To avoid duplicate content I would like to redirect www.domain.com
(just the home page) to www.domain.com/en/
.
How can I achieve this by using .htaccess
or any other intelligent method? Thank you.
Best Answer
I was looking for this as well. I just can't understand why Magento does not do this by default. I could not get this to work by using
.htaccess
But here's what looks like an intelligent method by Daniel Sloof that seems to work perfectly fine for my store, so kudo's to him for developing this little module!
app/code/local/Danslo/RedirectToStore/Model/Observer.php
app/code/local/Danslo/RedirectToStore/etc/config.xml
app/etc/modules/Danslo_RedirectToStore.xml
In addition to this, I also added to store code of my default store view to
index.php
so
now looks like
This does not seem to be entirely necessary, but I ran into this when Googling for a solution...
Hope this helps someone. If there is a better option or room for improvement, then please comment!