Reputation: 57
I've made a TLP system for PHP with .htaccess. And I want to exclude the /admin folder (in root folder). I've got this .htaccess:
RewriteEngine On
RewriteRule ^(|/)$ index.php?url=$1
RewriteRule ^([a-zA-Z0-9_-]+)(|/)$ index.php?url=$1
When I enter the /admin directory, it says: /admin/?url=admin. But I don't want it to request the ?url=admin.
Does somebody know how to exclude the /admin folder? Many thanks!
Upvotes: 2
Views: 4071
Reputation: 4490
Change your .htaccess, add the following lines:
//Ignore Admin folder
RewriteCond %{REQUEST_URI} !^/admin/
//Always add trailing slash
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://domain.com/$1/ [L,R=301]
You might want to check this URL out, everything explained just fine: http://enarion.net/web/htaccess/trailing-slash/
Upvotes: 2
Reputation: 1977
If you don't need any rewrites in your admin area, the simples way is to place a .htaccess file in the admin directory saying RewriteEngine Off
.
Another option would be to add the following above both rewrite rules:
RewriteCond %{REQUEST_URI} !^/admin/
.
Upvotes: 3