Catch all .htaccess - only if nothing is found bef

2019-07-19 22:10发布

问题:

Is it possible to have exceptions to a catch all regex in a .htaccess file ?

Here is my current .htaccess file

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ see.php?url=$1 [L]

I would like to have some exceptions to the catch all regex and only use it in the last case, if nothing is found before.

I tried to play with RewriteCond, but I weren't able to make this work.

Edit: I would like exceptions to be rewrited as well, it this possible ?

回答1:

Anything you place in the .htaccess file before the catch all rewrite will be executed first. So if you put an [L] flag on those rewrites then the processing stops there and the the catch all rewrite will not fire.

Make sense?