如果文件不存在,则htaccess url重写* OR *特定目录
问题描述:
I have an htaccess rewrite rule that rewrites if the file requested doesn't exist, but I would also like this rule to ignore this rule if the request falls within a specific directory. I am unsure how to do this however.
My current rewrite rule is this:
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/$1 [L]
How would you modify to ignore a specific directory?
我有一个htaccess重写规则,如果请求的文件不存在则重写,但我也想要这个规则 如果请求属于特定目录,则忽略此规则。 我不确定如何做到这一点。 p>
我当前的重写规则是: p>
RewriteBase /
RewriteCond%{REQUEST_FILENAME}! -f
RewriteRule ^(。*)$ /index.php/$1 [L]
code> pre>
如何修改忽略特定目录? p>
div>
答
RewriteBase /
RewriteCond %{REQUEST_URI} !^/foldername
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/$1 [L]
Should do the trick