I've got a .htaccess file as it follows:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)$ index.php [NC,L]
I've got this file in my web directory. Is there any way to force this rule to stop rewriting if there's a file?
For example: I've got a css/style.css file but the server returns 404 because the mod_rewrite rule works. If I turn the mod_rewrite off, the file is found.
Yes, there is:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteRule ^assets/(.*)$ public/assets/$1 [L]
</IfModule>
First block of conditions and the first rule is applied to existing files and folders, and the second rule if an actual rewrite that should happen if there is no file or folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With