Mobile app version of vmapp.org
Login or Join
Cooney921

: 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

@Cooney921

Posted in: #Configuration #Drupal #HttpdConf #Users

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Cooney921

1 Comments

Sorted by latest first Latest Oldest Best

 

@Angela700

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>

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme