I have a bunch of machines behind a firewall that act as my internal network (all running Linux). I am trying to setup a website (LAMP environment) that is only accessible for those internal machines. That is, they should only be able to access the webpage if their IP address matches my list.
I set the following in my httpd.conf file (so the .htaccess files can override the httpd.conf settings):
Code:
<Directory>
AllowOverride All
</Directory>
AccessFileName .htaccess
DefaultType text/plain
then restarted my apache server.
I then created an .htaccess file in the directory I wish to restrict access with the following:
Code:
order deny,allow
deny from all
allow from xxx.xxx.xxx.xxx
where "xxx.xxx.xxx.xxx" is the IP address I wish to allow access.
The above works as intended for those IP addresses not allowed (i.e. it returns an "Access Forbidden" code). However, for the allowed IP address, it treats the index.html file as an unrecognised mime type (it thinks it is an "text/x-server-parsed-html" mime type and asks me to download it instead of showing the page.
Also note that my httpd.conf file has the following:
Code:
<IfModule>
DirectoryIndex index.html index.htm
<IfModule>
So, it should return the index.html page when the URL is pointed to its directory. It returns it just fine for any directory that does not have an .htaccess file. Although, I am wondering if the "mod_dir.c" should be changed to "dir_module" as it is loaded that way (i.e. "LoadModule dir_module modules/mod_dir.so").
So, I tried to force it to recognise the mime type by adding the following to the .htaccess file:
Code:
AddType text/x-server-parsed-html .html
ForceType text/html .html
and various other versions of the above. Still doesn't work. The mime types are all declared (as they should be) in the mime.types file (in the "conf" directory). Nothing else was changed in the httpd.conf file.
I have done some Google searches, etc. This is a rather odd problem. I have been able to do what I am trying to do here on my localhost and there are no problems with the mime types. I have never even heard of a restricted access affecting mime types.
Any ideas?