.htaccess的重定向有关问题
时间:2021-07-01 10:21:17
帮助过:22人阅读
.htaccess 的重定向问题
我目前的.htaccess文件是这样的
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.tk0752.com$ [NC]
RewriteRule ^(.*)$ http://www.tk0752.com/$1 [L,R=301]
把所有xizi.tk域名原来的地址转移到tk0752.com下
但是我现在xizi.tk下面建立了二级域名1.xizi.tk,2.xizi.tk等,不希望进行重定向。
怎么适当修改这个文件呢
------解决方案--------------------
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.tk0752.com$ [NC]
RewriteRule ^(.*)$ http://www.tk0752.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^tk0752.com$ [NC]
RewriteRule ^(.*)$ http://www.tk0752.com/$1 [L,R=301]
------解决方案--------------------
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^[^12].tk0752.com$ [NC]
RewriteRule ^(.*)$ http://www.tk0752.com/$1 [L,R=301]