简体   繁体   中英

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

I currently have the following htaccess rewrite rule:

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

How do I make it exclude 2 certain strings like : 'template' and '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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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