[apache]apache下301重定向的设置
直接在.htaccess文件里设置,如下:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^xn--ygvo0Mb46A.com [NC]
RewriteRule ^(.*)$ http://www.9qc.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^www.xn--ygvo0Mb46A.com [NC]
RewriteRule ^(.*)$ http://www.9qc.com/$1 [L,R=301]
这样,xn--ygvo0Mb46A.com这个顶级域名和www.xn--ygvo0Mb46A.com这个二级域名都重定向到www.9qc.com这个域名了.检测工具检测如下:
查询地址:http://www.xn--ygvo0mb46a.com/
返回状态码:301
网页返回HEAD信息如下
Date: Tue, 06 Jul 2010 10:24:00 GMT
Location: http://www.9qc.com/
Cache-Control: max-age=31104000
Expires: Fri, 01 Jul 2011 10:24:00 GMT
Vary: Accept-Encoding
Content-Length: 227
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
查询地址:http://xn--ygvo0mb46a.com/
返回状态码:301
网页返回HEAD信息如下
Date: Tue, 06 Jul 2010 10:24:23 GMT
Location: http://www.9qc.com/
Cache-Control: max-age=31104000
Expires: Fri, 01 Jul 2011 10:24:23 GMT
Vary: Accept-Encoding
Content-Length: 227
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
热门文章推荐
- [apache]apache的添加mime类型mime.types作用说明
- [apache]在FMS下修改apache默认端口方法
- [php]解决Apache+PHP服务器提示HTTP 500问题
- [apache]如何配置路由器让外网能访问内网
- [apache]Apache+php+mysql在windows下的安装与配置图解
- [Apache]apache与lighttpd、nginx这三个WEB网站服务器分析
- [apache]基于apache配置反向代理的实现
- [apache]如何在apache服务器中添加本地环境的域名