don't rewrite static css/js/img files

.htaccess, mod-rewrite

Solution

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^.*\.(jpg|css|js|gif|png)$ [NC]
RewriteRule ^(.*)$ public/index.php?url=$1

All requests to not existing files which doesn't end with listed extensions (case nonsensitive match) are rewritten to `public/index.php` passing the current URL as `url=` GET argument

Problem

I'm trying to get my htaccess file not to rewrite my static files (js/css/images). This is my current htaccess file: ``` RewriteEngine on RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule !\.(jpg|css|js|gif|png)$ public/ [L] RewriteRule !\.(jpg|css|js|gif|png)$ public/index.php?url=$1 ``` How do I rewrite it?

Original source