Apache : Restrict access to URI, not resource
I'd like to restrict access to some URIs, but they do not physically match a clearly identified resource. I explain : if you ask http://domainname/admin, you do not strictly go to the admin dir, you go to a script, with some params; and this script can also be used in other contexts.
So, i'd like to make something like folder access restriction, but based on the URI asked for, not on the actuel resource (cause the /admin folder exists, of course :D).
How could i do开发者_C百科 that ?
TIA
In .htaccess Add the rewrite rule:
RewriteRule ^admin - [F,L]
This will deny access to paths starting with admin.
Use <Location>
/</Location>
tags in your httpd.conf (or whatever it's called this week), insert any access restrictions between the tags. For instance
<Location /admin>
Order deny,allow
Deny from all
Allow from localhost, admins-workstation.example.com
</Location>
精彩评论