Tag Archives: 301 redirect

Home »  Tag: 301 redirect

301 redirect

1. PHP redirect

1
2
3
4

<?php
header( “HTTP/1.1 301 Moved Permanently” );
header( “Location: http://www.msnote.co.kr” );
?>

2. JSP(Java) redirect

1
2
3
4
5

< %
response.setStatus(301);
response.setHeader( “Location”, “http://www.msnote.co.kr/” );
response.setHeader( “Connection”, “close” );
%>

3. ASP.NET redirect

1
2
3
4
5
6
7

<script runat=”server”>
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = “301 Moved Permanently”;
Response.AddHeader(“Location”,”http://www.msnote.co.kr”);
}
</script>

4. ASP redirect

1
2
3
4
5

< %@ Language=VBScript %>
< %
Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”,”http://www.msnote.co.kr/”
%>

5. Ruby on Rails redirect

1
2
3
4

def old_action
headers[“Status”] = “301 Moved Permanently”
redirect_to “http://www.msnote.co.kr/”
end

6. CGI Perl redirect

1
2

$q = new CGI;
print $q->redirect(“http://www.msnote.co.kr/”);

7. .htaccess mod_rewrite

1
2

RewriteEngine on
RewriteRule (.*) http://www.msnote.co.kr/$1 [R=301,L]