Link to home
Start Free TrialLog in
Avatar of Pranesh
PraneshFlag for Australia

asked on

Setting up restrictions on Apache

Hi Group

I was wondering if there is a way to restrict access to a particular directory using apache. I know there is however I was using the <Directory> option shipped in apache but it seems like when this is enable it affects all my sites.

for example if I wanted restrict access to a particular virtual host -

So for example I have a bunch of files in /var/www/mydir and I wanted to restrict access to only localhost.

How can I accomplish this without affecting any other operations of the webserver?

I am probably missing something in my config somewhere thats making the change global or something.

Any suggestions would be highly appreciated.

Thanks
Avatar of Anwar Saiah
Anwar Saiah

You can create .htaccess per directory and it will affect only current directory and what is beneath it.
Avatar of Pranesh

ASKER

Hi aboo_s

Thank for your feedback. I thought that .htaccess was for user access only. Suppose I wanted a particular ip range to only access that particular directory. How would I achieve that?

I thought we could use something link this :

<Directory /var/www/mydir/>
Order allow,deny
Allow from 10.0.0.
</Directory>

When I try this config, only getting the welcome page on all my websites.

Is there something I need to change in the order?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Anwar Saiah
Anwar Saiah

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Pranesh

ASKER

Thank you so much!!!!

Works like a charm...

:)
You are very welcome, glad I could have helped!