广告联盟网

 找回密码
 注册
查看: 506|回复: 1
打印 上一主题 下一主题

301转向的代码

[复制链接]
跳转到指定楼层
1#
发表于 2006-11-22 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
当你的网站链接或者某个网页的链接发生了改变,如何让原来在搜索引擎中收录的链接(URL)能够继续地有效,将用户导向当前的URL地址?
最有效和安全的方法是利用301 redirect,301转向能够保持你的网页的PageRank不变,从而使你过去的工作得到保证。“301”代码解释为永久性的转移。下面是几种方法进行301转向:
IIS Redirect

在IIS服务器管理器中,选择要做转向的文件或目录,按右键选择“a redirection to a URL”的按钮,输入你要指向的页面地址,选择”The exact url entered above”和”A permanent redirection for this resource”,然后选择“应用”。
Redirect in ColdFusion
< .cfheader statuscode=&quot;301&quot; statustext=&quot;Moved permanently&quot;>
< .cfheader name=&quot;Location&quot; value=&quot;http://www.new-url.com&quot;>

Redirect in PHP

< ?
Header( “HTTP/1.1 301 Moved Permanently” );
Header( “Location: http://www.new-url.com” );
?>
Redirect in ASP
< %@ Language=VBScript %>
< %
Response.Status=”301 Moved Permanently” Response.AddHeader “Location”, ” http://www.new-url.com”
>
Redirect in ASP .NET

用 .htaccess 文件转向
创建一个.htaccess文件,在.htaccess文件中加入:
Redirect permanent / http://www.new-url.com
或 Redirect 301 / http://www.new-url.com
2#
 楼主| 发表于 2006-11-22 | 只看该作者
但是不知道怎么用,我的页面是生成静态页面的,如何设置使用301转向呢,因为空间是买的虚拟主机,请各位指教。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|广告联盟网  

GMT, 2024-10-2 , Processed in 0.066746 second(s), 19 queries .

Powered by Discuz! X3.2

© 2005-2021 www.ggads.com GGADS 广告联盟网

快速回复 返回顶部 返回列表