ITeye博客

apache 301重定向的设置方法

化蝶自在飞 · 2010-07-06 18:19 · windows · 操作系统 · HTML · Cache · Apache · Markdown

直接在.htaccess文件里设置,如下: RewriteEngine on RewriteCond %{HTTP_HOST} ^xn--ygvo0Mb46A.com RewriteRule ^(.)$ http://www.9qc.com/$1 RewriteCond %{HTTP_HOST} ^www.xn--ygvo0Mb46A.com RewriteRule ^(.)$ http://www.9qc.com/$1 这样,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

但是这个重定向好像不支持中文域名,比如 www.旧汽车.com ,这样做以后会显示302 . 交流更多 apache 301重定向的设置方法 ,去 www.9qc.com 看看.

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。