我目前有以下 htaccess 重写规则:
RewriteRule (.*) index.php/$1 [L]
如何让它排除 2 个特定的字符串,例如:'template' 和 'image'?
我看了其他帖子,但我不清楚。
最佳答案
你可以做一个否定的重写条件
像这样:
RewriteCond %{REQUEST_URI} !^/(template|image)
RewriteRule (.*) index.php/$1 [L]
这实际上不会重写任何指向图像和模板文件夹中内容的 url。
关于regex - 重写规则从 Regex 中的 (.*) 中排除某些字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11172642/