Home  >  Article  >  Backend Development  >  求apche重定向规约

求apche重定向规约

WBOY
WBOYOriginal
2016-06-13 12:02:31828browse

求apche重定向规则
RewriteRule ^(?!admin|user|inde\.php|config\.php|%{HTTP_HOST}) %{HTTP_HOST} [R=301.L] 

求除了首页及admin目录和user目录以及index.php和config.php 都转跳到首页...
------解决方案--------------------

<br />RewriteEngine on<br />RewriteBase /<br />RewriteCond $1 !^(admin\/(.*)<br><font color='#FF8000'>------解决方案--------------------</font><br>$)<br />RewriteCond $1 !^(user\/(.*)<br><font color='#FF8000'>------解决方案--------------------</font><br>$)<br />RewriteCond $1 !^(index.php(.*)<br><font color='#FF8000'>------解决方案--------------------</font><br>$)<br />RewriteCond $1 !^(config.php(.*)<br><font color='#FF8000'>------解决方案--------------------</font><br>$)<br />RewriteRule ^(.*)$ index.php [L,QSA]<br />

------解决方案--------------------
RewriteRule ^(?!admin(/.*)?
------解决方案--------------------
user(/.*)?
------解决方案--------------------
config\.php)$ index.php

这样能行吗?
------解决方案--------------------
重定向都用于不同域名间的转向,实际由浏览器完成
你重定向到自己,不会死循环吗?
仅仅路径不同,那就直接指派就可以了

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