Maison  >  Article  >  développement back-end  >  .htaccess 的重定向有关问题

.htaccess 的重定向有关问题

WBOY
WBOYoriginal
2016-06-13 13:41:19875parcourir

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

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn