一般跳转有三种,通过asp或php程序,页面中meta和js跳转。
其中,meta和js跳转都属于302跳转,301重定向是网页更改地址后对搜索引擎友好的最好方法,只要不是暂时搬移的情况,都建议使用301来做转址。
以下是一些我整理的代码:
asp:
- <%
- Response.Status="301 Moved Permanently"
- Response.AddHeader "Location","http://www.9enjoy.com"
- %>
php:
- <?
- Header( "HTTP/1.1 301 Moved Permanently" ) ;
- Header( "Location: http://www.9enjoy.com" );
- ?>
asp.net
- <script runat="server">
- private void Page_Load(object sender, System.EventArgs e)
- {
- Response.Status = "301 Moved Permanently";
- Response.AddHeader ("Location","http://www.9enjoy.com");
- }
- </script>