views:

225

answers:

5

I have some script in my default page that redirects users to language specific versions of my website depending on the language of the browser. I want to add something that redirects those users who do NOT have Javascript enabled.

Currently I have the following :

<noscript>
  <META HTTP-EQUIV=REFRESH CONTENT="1; URL=en/index.htm">.
</noscript>

But I've read this is not too wise as some search engines frown upon it. How do I do this and keep search engines happy?

+7  A: 

You should use a .htaccess file to detect the browser's language from the headers (using a regular expression) and then redirect them that way. Doing that is completely agnostic of the client-side configuration and search engines will handle it properly. There is a ton of information out there on specifically how to accomplish this.

Marc W
And if he's using IIS? Nothing to do with .htaccess file!
backslash17
+5  A: 

It could be done with a server side language by adding the following http header

Location: /en/index

will redirect the user to http://www.example.com/en/index

Boris Guéry
You also need to return a 301 (permanent redirect) or 302 (temporary redirect) as the HTTP status code. This header alone is not sufficient.
Brad Wilson
Indeed, i forgot to mention it !
Boris Guéry
+3  A: 

You'll need to parse the Accept-Language HTTP header.

Ben Alpert
+2  A: 

Why don't you redirect on the server side, by responding with a 302 HTTP status code. I don't know what you have on the server, but all frameworks support it.

Gidon
+2  A: 

You can redirect at server side with 301 HTTP status code too. This is the best way to do it for good SEO. The example is in C# but every plattform has his own method to add headers to the response:

Response.Clear();
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", "/newfolder/newfilelocation");

The reason to use the 301 status code is that the search engine indexes the new page because it was "Moved permanently" instead of the 302 that was "Moved temporarily".

backslash17