For 301 redirects using the. htaccess file, see my other article, "301 redirect, change domain name to new domain name"
。
If the space does not support the. htaccess file, then we can also use the Php/asp code for 301 redirects.
In order to update the search engine records to the current domain name above, did a few 301 redirect Dongdong, for everyone to share.
ASP 301 Steering Code
Add the following lines to the top of the index.asp or default.asp:
Copy Code code as follows:
<%
Response.status= "Moved Permanently"
Response.AddHeader "Location", "http://www.jb51.net/"
Response.End
%>
PHP 301 Steering Code
Add the following lines to the top of the index.php:
Copy Code code as follows:
<?php
Header ("http/1.1 moved Permanently");
Header ("location:http://www.jb51.net/");
Exit ();
?>
asp.net 301 Steering Code
Copy Code code as follows:
<%@ Page language= "C #"%>
<script runat= "Server" >
protected void Page_Load (object sender, EventArgs e)
{
HttpContext.Current.Response.StatusCode = 301;
HttpContext.Current.Response.Status = "Moved Permanently";
HttpContext.Current.Response.AddHeader ("Location", "http://www.jb51.net");
}
</script>
301 represents a permanent transfer (permanently moved), 301 redirect is the best way to search engine friendliness after a Web page change, only
If it is not temporarily moved, it is recommended that the 301来 be used as a transfer site.
301 redirects under the JSP
Copy Code code as follows:
<%@ page language= "java" pageencoding= "GBK"%>
<%
Response.setstatus (response. sc_moved_permanently);
Response.AddHeader ("Location", "http://www.7hinet.com");
%>
You can control the path or page that needs to be redirected through the filter