繁体   English   中英

.htaccess将所有内容重写为index.php,但特定文件夹中的脚本除外

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM