Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

htaccess url rewrite if file doesn't exist *OR* specific directory

I have an htaccess rewrite rule that rewrites if the file requested doesn't exist, but I would also like this rule to ignore this rule if the request falls within a specific directory. I am unsure how to do this however.

My current rewrite rule is this:

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/$1 [L]

How would you modify to ignore a specific directory?

like image 347
dqhendricks Avatar asked Dec 08 '25 07:12

dqhendricks


1 Answers

RewriteBase /
RewriteCond %{REQUEST_URI} !^/foldername
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/$1 [L]

Should do the trick

like image 121
Thomas Avatar answered Dec 10 '25 10:12

Thomas