Reputation: 6181
I'm learning about .htaccess
, and have a file with the current rules:
Options -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /index.php [L]
Is there any way I can modify the RewriteCond
to do only re-direct if the request does not end in .png
or something else?
Upvotes: 1
Views: 86
Reputation: 70722
Add another RewriteCond
to exclude certain conditions that you don't want rewritten. As @acheong87 stated, prefix !
before the regular expression indicating that any files that match should fail.
RewriteCond %{REQUEST_URI} !\.(png|jpg|etc..)$
Upvotes: 3
Reputation: 30273
Prefix your expression with !
, like so:
RewriteRule !\.png$ /index.php [L]
The $
is known as an anchor, and matches the end of the string.
Upvotes: 2