views:

38

answers:

2

We would like to redirect to a localized version of our entry webpage if IP is detected to be from a certain country. We are using ASP.Net, GeoLite Country Db (it's a very small, 1Mb downloadable DB at time of writing this question).

So, most users would get english content, but if they come from a local place, they would have local content served by default. Of course, they would be able to change the preferred language at any time.

The question is: if www.example.com by default displays default.aspx, should we (if we detect the IP to be "local"):

  1. Use "301 Moved Permanently" and redirect it to, say, www.example.com/local.aspx, or

  2. Simply render the appropriate content inside default.aspx?

We would like to know if there are some side effects with SEO or similar issues with any of the approaches?

+2  A: 

This may not be the best solution.

From wikipedia it says to use 300 for different languages:

http://en.wikipedia.org/wiki/URL_redirection

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.1

The HTTP standard defines several status codes for redirection:

* 300 multiple choices (e.g. offer different languages)
* 301 moved permanently
* 302 found (originally temporary redirect, but now commonly used to specify redirection for unspecified reason)
* 303 see other (e.g. for results of cgi-scripts)
* 307 temporary redirect
John Boker
The status code 300 should be used if the negotiation fails.
Gumbo
in the docs it says "If the server has a preferred choice of representation, it SHOULD include the specific URI for that representation in the Location field; user agents MAY use the Location field value for automatic redirection. This response is cacheable unless indicated otherwise."
John Boker
@John Boker: But the negotiation does not fail in this case. So using 300 is not appropriate.
Gumbo
And what about 307? Would it serve better than 301 in this case?
Groo
+1  A: 

I would just deliver the localized contents of local.aspx and send an appropriate Content-Location referring to local.aspx along with it.

Or, if you want a redirect, use the status code 307 to indicate a temporary redirect.

Gumbo
307 seemed appropriate to me also, however HTTP/1.0 agents won't recognize it. I will probably render it. Should I use `Server.Execute` or is there another way?
Groo
@Groo: You could reply with a 302 in that case.
Gumbo
Ok, that's what we'll use.
Groo