是啊,查了半天百度,也没搞清301怎么做,,不知我理解不行还是..
在百度上看到下面的做法,不知代码放哪里
谁知?
用程序来做
用PHP来做301重定向
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location:
http://www.1.com" );
?>
用JSP (Java)来做301重定向
<%
response.setStatus(301);
response.setHeader( "Location", "http://www.1.com/" );
response.setHeader( "Connection", "close" );
%>
用CGI PERL 来做301重定向
$q = new CGI;
print $q->redirect("http://www.1.com/");
用ASP来做301重定向
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently";
Response.AddHeader("Location","http://www.1.com/");
%>
用ColdFusion 来做301重定向
<.cfheader statuscode="301" statustext="Moved permanently">
<.cfheader name="Location" value="http://www.1.com">
用ASP .NET Redirect来做301重定向
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.1.com");
}
</script>
用Ruby on Rails Redirect来做301重定向
def old_action
headers["Status"] = "301 Moved Permanently"
redirect_to "http://www.1.com/"
end
html的meta refresh和javascript也可以转向
<meta http-equiv="Refresh" content="0; url=http://1.com/page.html">
<script>
window.location="http://www.1.com/test.html";
</script>