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开发者_C百科 [L,QSA]
Apache 2.2.9, Debian
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/
.
I think it's because the first slash in
RewriteCond %{REQUEST_URI} !^/thumbs/(.*)$
精彩评论