静态网站或者说是伪静态的网站如何做301的重定向设置呢?
下面的方法都是传递百度权重的:
1、在.htaccess文件中增加301重定向指令(只适用于linux系统,并需要虚拟主机支持。)
RewriteEngine on
RewriteCond %{http_host} ^kuawoa.com [NC]
RewriteRule ^(.*)$ http://www.seowindows.com/$1 [L,R=301]
2、绑定/本地DNS,可以通过域名操作后台实现DNS转发让顶级域名转发到一级域名上。
3、适用于使用Unix系统的用户
通过此指令通知搜索引擎的spider你的站点文件不在此地址下。这是较为常用的办法。形如:Redirect 301 / http://www.seowindows.com
4、动态301重定向(注:代码需放入公共文件)
asp重定向代码:
Response.Status="301 Moved Permanently"
Response.AddHeader "Location"," http://www.baidu.com/"
Response.End
php重定向代码:
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.baidu.com/");
exit()
ASP .NET下的301重定向:
<script runat=”server”>
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = “301 Moved Permanently”;
Response.AddHeader(”Location”,” http://www.seowindows.com”);
}
</script>
JSP下的301重定向代码:
<% response.setStatus(301); response.setHeader( "Location", " http://www.seowindows.com/" ); response.setHeader( "Connection", "close" ); %>