Home  >  Article  >  Backend Development  >  .htaccess 的重定向有关问题

.htaccess 的重定向有关问题

WBOY
WBOYOriginal
2016-06-13 13:41:19875browse

.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]

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn