Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RewriteRule only if directory or file does not exists

I'm trying to create a url handler by using php and .htaccess, my problem is that I don't know how to use rewrite condition only if the file\directory entered in the url does not exists.

like image 551
Yehonatan Avatar asked Nov 30 '22 14:11

Yehonatan


1 Answers

Please have a look at this RewriteCond resource.

RewriteCond %{REQUEST_FILENAME} !-f
//                                ^ this means file.
RewriteCond %{REQUEST_FILENAME} !-d
//                              ^ this means NOT, "d" means directory.
// Your rewrite rule here.
like image 200
Adi Avatar answered Dec 04 '22 09:12

Adi