庄河SEO中心将SEO工作中所需要的301重定向代码进行了收集整理,现贴出来与大家分享。
1、ASP下的301重定向代码
ASP/Visual Basic Code复制内容到剪贴板
- <%@ Language=VBScript %>
- <%
- Response.Status="301 Moved Permanently"
- Response.AddHeader "Location", "http://zhuangheseo.com/index.html"
- %>
2、ASP.Net下的301重定向代码
复制内容到剪贴板
- <script runat="server">
- private void Page_Load(object sender, System.EventArgs e)
- {
- Response.Status = "301 Moved Permanently";
- Response.AddHeader("Location","http://zhuangheseo.com/index.html");
- }
- </script>
3、PHP下的301重定向代码
PHP Code复制内容到剪贴板
- header("HTTP/1.1 301 Moved Permanently");
- header("Location: http://zhuangheseo.com/index.html");
- exit();
4、CGI Perl下的301重定向代码
复制内容到剪贴板
- $q = new CGI;
- print $q->redirect("http://zhuangheseo.com/");
5、JSP下的301重定向代码
复制内容到剪贴板
- <%
- response.setStatus(301);
- response.setHeader( "Location", "http://zhuangheseo.com/" );
- response.setHeader( "Connection", "close" );
- %>
你浏览的文章是 - 《整理好最全的301重定向代码与方法》!
文章出处:http://zhuangheseo.com/seo_f.html