views:

21

answers:

2

working .htaccess config:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_URI} ^thumbs/(.*)$
RewriteRule ^(.+)$ /index.php [L,QSA]

All 404 queries to /thumbs/ folder not must be catched by /index.php script. Why top .htaccess config work and bottom config not work?

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_URI} !^/thumbs/(.*)$
RewriteRule ^(.+)$ /index.php [L,QSA]

Apache 2.2.9, Debian

A: 

I think it's because the first slash in

RewriteCond %{REQUEST_URI} !^/thumbs/(.*)$
revaxarts
RewriteCond %{REQUEST_URI} !^thumbs/(.*)$ not work too
nex2hex
A: 

REQUEST_URI contains the requested URI path and does always start with a slash.

So the pattern ^thumbs/(.*)$ does never match as it’s missing the leading /. But the other condition, !^/thumbs/(.*)$, should match every request that’s URI path does not start with /thumbs/.

Gumbo