1

I am trying to limit access to a website to a small set of IP addresses. I am a regular user on the Mac OSX web server. My first attempt at limited access was to create an .htaccess

order deny,allow
deny from all
allow from 192.168.0.1

where 192.168.0.1 is the IP address of the machine I want to allow in the sub directory of the website that I want to limit access to. As far as I can tell, the .htaccess file does nothing since I can access files in the sub-directory from both 192.168.0.1 and 192.168.0.2. Presumably the administrators of the web server have not enabled .htaccess override.

In the top level directory of the website is a file called .www_access:

Options +Includes

I cannot find any information about this file. Copying the file to the sub-directory and adding the .htaccess stuff to give a .www_access of:

Options +Includes
order deny,allow
deny from all
allow from 192.168.0.1

sort of works. I can access the files in the sub-directory from 192.168.0.1 and cannot access them from 192.168.0.2, but when I try and access from 192.168.0.2 I get a "500 internal server error" and I was expecting a "403 access forbidden". Adding an error document redirect to .www_access

Options +Includes
ErrorDocument 500 http://www.google.com
order deny,allow
deny from all
allow from 192.168.0.1

has no effect.

Given I have no idea what .www_access is doing, I am not sure I should be going down this route. Is it possible to limit access to a website to a small set of IP addresses if the web server does not support .htaccess files?

The web server has PHP installed, but doesn't see to allow web pages to use it. If I create a php test file

#! /usr/bin/php
<?php
phpinfo();
?>

and then ssh into the web server I can run it from the command line and get lots of information. If I then try and accesses it from a browser, I just get the code back. I think there are other scripting languages installed on the webserver, but as far as I can tell none are accessible from the web.

  • @Christopher added some information about scripting languages. The web server has PHP, but I cannot use it from the web. – StrongBad May 30 '14 at 13:03
0

Is it possible to limit access to a website to a small set of IP addresses if the web server does not support .htaccess files?

The definition of the Apache virtual host can be changed without enabling .htaccess files. This is a bit faster anyway. Just ask them to limit the site to certain subnets.

<Directory "<file system path>">
    Options Indexes MultiViews
    FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 192.168.0.0/24
</Directory>
  • The web server is running on top of OSX/Darwin so it is pretty main stream. The Apache tutorial recommends not using .htaccess. I am not sure why the web server administrators disabled (didn't enable) php, but they are not going to change the set up. – StrongBad May 30 '14 at 13:22
1

I eventually got the web server admins to respond to me. For whatever reason they have decided to rename .htaccess to .wwwaccess. My issues with the error pages is do to an somewhat related issue with how the admins have setup the proxy/firewall.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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