301 redirect
Tagged in and posted in Apache

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]

Leave your Comment

Your email address will not be published. Required fields are marked *