: Filter admin access by IP with httpd.conf I am trying to filter all backend url to one IP in the httpd.conf file using this code: <Location /admin> Order deny,allow Deny from
I am trying to filter all backend url to one IP in the httpd.conf file using this code:
<Location /admin>
Order deny,allow
Deny from all
Allow from 100.x.xxx.xxx
</Location>
This one works fine. I can't find a way to do the same with /?q=admin.
<Location /?q=admin>
Order deny,allow
Deny from all
Allow from 100.x.xxx.xxx
</Location>
Do I need some regular expression with backslash to escape some of the characters?
More posts by @Cooney921
1 Comments
Sorted by latest first Latest Oldest Best
I would strongly recommend for the second one that has special characters that you use the <LocationMatch> Directive.
The <LocationMatch> directive limits the scope of the enclosed
directives by URL, in an identical manner to <Location>. However, it
takes a regular expression as an argument instead of a simple string.
(http://httpd.apache.org/docs/2.2/mod/core.html#locationmatch)
For your particular case, use:
<LocationMatch /?q=admin>
Order deny,allow
Deny from all
Allow from 100.x.xxx.xxx
</LocationMatch>
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.