Well, the way you configure it, everything goes through index.php . If a resource is requested that does not exist, it is routed through index.php . It is before index.php to implement something wrong and return a 404 error, but I assume that it is configured so that if url= does not exist to return the home page.
You can change your rules to ignore routing for specific files, for example, for your example:
RewriteEngine on RewriteCond %{REQUEST_URI} !^/js/ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
This will lead to the fact that nothing in the /js directory will ever be routed through index.php , so if someone asks for a nonexistent file in the /js directory, he will simply get the usual 404 response.
EDIT:
This is what I want to ignore the routing for certain files (js, css, images), because if the files do not exist, I get a normal error!
If you want to ignore all images, javascript and css, then the second line should be:
RewriteCond %{REQUEST_URI} !\.(png|jpe?g|gif|css|js)$ [NC]
source share