Joséph Flames
Joséph Flames

Reputation: 220

Apache rewrite does not ignore specific directory rule

So I have this set up in my apache conf file

RewriteRule ^(database)($|/) - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

I have a phpmyadmin setup at example.com/database I also have a REST API setup where something like example.com/records/DELETE/{id} would lead you to example.com/index.php where the index.php handles parsing of the url

What I am expecting to happen is that typing in example.com/database it would take me to the phpmyadmin instance(basically ignoring the other rewrite rules)

if it is not example.com/database then it should go to the example.com/index.php

Thanks Joseph

Upvotes: 0

Views: 98

Answers (1)

BadHorsie
BadHorsie

Reputation: 14544

You can provide a condition to say redirect everything that isn't your database URL.

RewriteCond %{REQUEST_URI} !^/database/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /index.php [QSA,L]

Upvotes: 1

Related Questions