Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been attempting to restrict access to an internet connected apache instance. My router has a port forward to the machine that is running apache. Don't know if this makes a difference.

Anyway I want to restrict it to LAN access only for the moment, and I want to use htaccess so that later I can enable visitors based on specific IPs. It is a dev server that I want my clients to be able to remotely preview, but not anyone else.

I've tried the instructions here: which explain to do this

order deny,allow
deny from all
allow from 192.168.1

In my .htaccess file, but this doesn't work, I can still access it from outside the lan. I'm trying it from my phone's 3g and it works.

If I change the order to something like

Order Deny,Allow
Deny from all
Allow from 192.168.1

(remove the comma) as per the apache docs here: and the page still allows access on my phone and on the local.

Any ideas?

share|improve this question
Can you please post the contents of "error.log" so we can examine and pinpoint the issue? – U4iK_HaZe Aug 30 '11 at 4:23
Or the access log if there aren't any errors. And don't "censor" any IP addresses if/when you do post them. They are the most important bit of this problem. – Ladadadada Dec 10 '11 at 11:00

Check if you have AllowOverride All to make sure that your .htaccess is not ignored.

share|improve this answer
What config file should this be in? – Jason Aug 30 '11 at 23:50
The <Directory> directive for your DocumentRoot in the main config file httpd.conf. – quanta Aug 31 '11 at 2:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.