简体   繁体   English

重写规则从正则表达式(。*)中排除某些字符串

[英]Rewrite Rule exclude certain strings from (.*) in Regex

I currently have the following htaccess rewrite rule: 我目前有以下htaccess重写规则:

RewriteRule    (.*) index.php/$1 [L]

How do I make it exclude 2 certain strings like : 'template' and 'image'? 如何排除2个特定字符串,例如“ template”和“ image”?

I read other posts but it was not clear to me. 我读了其他帖子,但我不清楚。

You could make a negating rewrite condition 您可以做出否定的重写条件

Like this: 像这样:

RewriteCond %{REQUEST_URI} !^/(template|image)
RewriteRule (.*) index.php/$1 [L]

Which effectively doesn't rewrite any urls pointing to things in the image and template folder. 它实际上不会重写指向图像和模板文件夹中内容的所有url。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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