Jump to content

Redirect when changing language


Recommended Posts

When I set up my new shop I left the default languages installed, but then decided to delete all languages besides English. Now google has indexed my products with /en in the path, so when people search and click on these products they see a 404 error. Is there any way to redirect from www.mysite.com/en to www.mysite.com until google has re-indexed the pages?

 

Thanks,

 

Marc

Link to comment
Share on other sites

Assuming you are running Apache and you have mod_rewrite installed,

 

# Redirect the request to URL w/o /en/ after "301 Moved Permanently" response
RewriteRule ^(.*)/en/(.*) $1/$2 [R=301]

 

test thoroughly to make sure that it does not conflict with any redirect rule you may already have. It is difficult to account affects any other Apache modules like mod_alias and mod_userdir may have on the incoming request so rewriting is a server dependent process. Thus above may or may not work with your server. If it does not, post again.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...