Manny Manny - 1 month ago 5x
Apache Configuration Question

How to create rewrite rule that allows to rewrite something right after slash with exceptions

i want to create these rewrite rules:



But I also need to use images and some other files and also other PHP files.

The .htaccess i have:

RewriteCond %{REQUEST_URI} !(\.png|\.jpg|\.gif|\.jpeg|\.bmp|\.css)$
RewriteRule ^(.*)$ index.php?site=$1 [QSA]

The problem is when i try to load file like this:

It doesn't work, because i don't know how to avoid rewriting PHP files.


Try this Rule,

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?site=$1 [QSA]