最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
apache中如何实现301转向
时间:2010-11-22 编辑:简简单单 来源:一聚教程网
编辑.htaccess的方法。
注意:在设置301重定向之前务必备份相应目录下的.htaccess文件。
1.重定向111com.net到www.111com.net
这种重定向旨在使域名唯一,是网站seo教程必须要做的,后面重定向www.111com.net到111com.net也是出于同样的原因,只是形式不同。
打开.htaccess文件,加入以下规则。(下面的规则是针对主域名的,子域名要修改)
rewriteengine on
rewritecond %{http_host} !^www.111com.net$ [nc]
rewriterule ^(.*)$ http://www.111com.net/$1 [l,r=301]
2.重定向www.111com.net到111com.net
rewriteengine on
rewritecond %{http_host} !^111com.net$ [nc]
rewriterule ^(.*)$ http://111com.net/$1 [l,r=301]
3.重定向old111com.net到www.new111com.net
rewriteengine on
rewritecond %{http_host} !old111com.net$ [nc]
rewriterule ^(.*)$ http://www.new111com.net/$1 [l,r=301]
4.重定向old111com.net to new111com.net
rewriteengine on
rewritebase /
rewritecond %{http_host} !old111com.net$ [nc]
rewriterule ^(.*)$ http://new111com.net/$1 [l,r=301]
5.重定向111com.net/file/file.php教程 到 other111com.net/otherfile/other.php
rewritecond %{http_host} ^www.111com.net$
rewriterule ^file/file.php$ http://www.other111com.net/otherfile/other.php [r=301,l]
相关文章
- apache 301 将带www的域名转向不带www的域名 10-02
- Apache 301转向实现方法介绍 09-28
- PHP导出数据超时的优化建议解读 10-31
- PHP之mysql位运算解析 10-31
- Laravel实现登录跳转功能解析 10-31
- php双向队列解读 10-31