Home / Others / 301 Redirect in different languages
301 Redirect in different languages

It is very easy to just Redirect user to another page in different types of languages eg: asp.net,php,java etc. But sometimes we need to redirect user to another page with Status Code 301. What is 301 redirect? 301 redirect means permanent redirect from one URL to the other. 301 redirect gives beneficial of SEO, by this your website ranking will not effected.

Let's see How to do 301 Redirect in different laguages :

301 Redirect Code in Classic ASP

<%@ Language=VBScript %>
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.example.com/"

301 Redirect Code in ASP.Net

Response.Status="301 Moved Permanently";

301 Redirect Code in PHP

header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.example.com");

301 Redirect Code in Java

response.setHeader( “Location”, “http://www.example.com/” );
response.setHeader( “Connection”, “close” );

301 Redirect Code in .htaccess

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.net/$1 [L,R=301,NC]