Home > Backend Development > PHP Tutorial > PHP索引里.htaccess 重定向到一个文件

PHP索引里.htaccess 重定向到一个文件

WBOY
Release: 2016-06-13 12:01:45
Original
1143 people have browsed it

PHP目录里.htaccess 重定向到一个文件
请问怎么配置.htaccess使:
除根目录下resource文件夹里的内容外,其它的路径都重定向到根目录的index.php
如:
http://www.doman.com/resource/.*不重定向

http://www.doman.com/index.html
http://www.doman.com/config.php
http://www.doman.com/views/index.html
http://www.doman.com/XXX/XX.html
.........
类似以上不是resource里的内容都重定向到http://www.doman.com/index.php

谢谢!
------解决方案--------------------
Redirect 301 ^(^resource)$ http://www.doman.com/index.php
------解决方案--------------------
RewriteCond resource/.* !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
------解决方案--------------------
不可能!我怀疑你是否写对了,.htaccess 是否生效了

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template