-   Linux - Server (
-   -   use htaccess higher up directory no symlinks? (

qwertyjjj 12-02-2011 05:28 AM

use htaccess higher up directory no symlinks?
I have 3 folders for 3 different websites all with an admin folder that I currently block off IP addresses with via an htaccess file:

order deny,allow
deny from all
allow from


Each site runs different code and different databases so I cannot combine them.

How can I combine each of these htaccess files into 1 htacess file at the higher level domain linuxfolder so I don;t have to keep adding IP addresses into 3 individual files?

I do not have root access to the server so cannot use symlinks.

bathory 12-02-2011 04:46 PM


I guess /path/to/linuxfolder is your docroot. If that's the case, you can use mod_rewrite in a .htaccess file in docroot, like this:

RewriteEngine on

RewriteCond %{REQUEST_URI} ^/admin
RewriteCond %{REMOTE_HOST} !^109.150.55
RewriteRule (.*) - [F]

If you want to allow saccess to pecific hosts and not to the whole subnet, you can replace the 2nd RewriteCond with this

RewriteCond %{REMOTE_HOST} !^
RewriteCond %{REMOTE_HOST} !^

and so on


KernelJay 08-20-2012 09:10 AM

Be careful with that Limit Tag
qwertyjjj - I realize this response is a couple months late, but please note that there is some potential for this style of htaccess configuration to be bypassed. As outlined in the linked blog post, Apache may still hand off a request from those IPs if they use an HTTP method other than what you have specified in the Limit tag.

Read about it here:

All times are GMT -5. The time now is 10:23 PM.