![](/img/trans.png)
[英]htaccess - redirect everything to index.php except a folder and specific files
[英].htaccess rewrite everything to index.php except scripts in a specific folder
我有两个可公开访问的文件夹:
/public
/legacy
现在,我希望将所有请求重定向到/public/index.php,但以/ legacy开头的请求除外:
/users --> /public/index.php
/legacy/somescript.php --> /legacy/somescript.php
目前,我只有以下.htaccess文件:
/:
Order deny,allow
Deny from all
/ public和/ legacy:
Order allow,deny
Allow from all
您可以尝试使用此mod_rewrite规则
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/(legacy/.*)$
RewriteRule . /public/index.php [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.