RSS
热门关键字:  迅雷下载  下载  下载迅雷  迅雷 下载  迅雷
当前位置 : 主页>迅雷学堂>列表

seo常用代码:301永久重定向代码

来源: 作者: 时间:2008-03-27 点击:

7、Apache下301转向代码 站.长站

新建.htaccess文件,输入下列内容(需要开启mod_rewrite):

1)将不带WWW的域名转向到带WWW的域名下

xunlei6.org.cn

 

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^lesishu.cn [NC]
RewriteRule ^(.*)$
/$1 [L,R=301]
www.xunlei6.org.cn

2)重定向到新域名

xunlei6.org.cnb

 

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$
/$1 [L,R=301]
Chinaz~com

3)使用正则进行301转向,实现伪静态

 

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^news-(.+)\.html$ news.php?id=$1

将news.php?id=123这样的地址转向到news-123.html

 

8、Apache下vhosts.conf中配置301转向

为实现URL规范化,SEO通常将不带WWW的域名转向到带WWW域名,vhosts.conf中配置为: Chinaz

<VirtualHost *:80>
ServerName
www.xunlei6.org.cn
DocumentRoot /home/lesishu
< irtualHost>

<VirtualHost *:80>
ServerName lesishu.cn
RedirectMatch permanent ^/(.*)

/$1

< irtualHost> Chinaz^com

 

Apache下除了以上2种方法,还有其他配置方法和可选参数,建议阅读Apache文档。

  推荐下载: 立即高速下载
最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册