What's the best way to redirect a webpage without using Javascript?

I have some script in my default page that redirects users to the language versions of my website depending on the browser language. I want to add something that redirects those users who don't have Javascript.

I currently have the following:

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

      

But I read that this is not too wise, as some search engines have frowned. How do I do this and keep the search engines happy?

0


a source to share


5 answers


You can redirect on the server side also the HTTP 301 status code. This is the best way to do it for good SEO. An example is provided in C #, but each plattform has its own method for adding headers to the response:

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

      



The reason for using the 301 status code is that the search engine is indexing the new page because it was "moved permanently" instead of the 302 that was "temporarily moved".

+2


a source


You have to use the .htaccess file to detect the browser language from the headers (using a regex) and then redirect them that way. Doing this is completely independent of the client configuration and search engines will handle it as expected. There is a ton of information here on how to do this.



+7


a source


This can be done with server side language by adding the following http header

Location: /en/index

      

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

+5


a source


+3


a source


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

+2


a source







All Articles