Php htaccess重定向(如果不以文件夹开头)
我想创建一个白名单文件夹,并将所有其他请求重定向到索引Php htaccess重定向(如果不以文件夹开头),php,.htaccess,mod-rewrite,url-rewriting,Php,.htaccess,Mod Rewrite,Url Rewriting,我想创建一个白名单文件夹,并将所有其他请求重定向到索引 url.com/public/.* <-- Can access to file on public folder url.com/xxxx <-- redirect to index.php url.com/public/*试试: 不,因为我可以访问url.com/i\m\u a\u机密文件和现有文件是的,它可以工作!实际上,通过将RewriteBase/添加到我的htaccess中,500错误就消失了 <IfModu
url.com/public/.* <-- Can access to file on public folder
url.com/xxxx <-- redirect to index.php
url.com/public/*试试:
不,因为我可以访问url.com/i\m\u a\u机密文件和现有文件
是的,它可以工作!实际上,通过将RewriteBase/
添加到我的htaccess中,500错误就消失了
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteRule !^public/.* index.php [L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteRule !^public /index.php [L]