Access Denial/Approval by Domain

The following information is "Use at your own risk"!!

Ever wanted a directory that was restricted to everyone outside your domain? Better yet, did you want anyone access WITHIN your domain denied? Well, here's how to setup access denial/approval of a directory on the WWW.


The .htaccess - Allowing certain domains access

The .htaccess file is needed to tell the web browser that the directory is protected in some manner via domain name. The .htaccess file is placed within the directory you want to restrict. Much like the .htaccess file used in password protecting a directory. However, the difference is in the content of the .htaccess. Place the following within the file:
AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName OnlyFromUNO

<Limit GET>
order deny,allow
deny from all
allow from .unomaha.edu
allow from .novia.net
</Limit>
You can copy the above for yourself, but replace the "allow from" lines with the appropriate domains that you want to have access. Not too difficult, this one is really simple.


The .htaccess - Denying certain domains access

The concept allowing all domains EXCEPT certain ones remains simple. The same .htaccess can be used with some changes in wording.
AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName NotFromUNONovia

<Limit GET>
order allow,deny
allow from all
deny from .unomaha.edu
deny from .novia.net
</Limit>

This will allow access to the directory from ALL sites except those specified. Simple enough?


Remember to chmod 604 .htaccess so it can be read by the browser!
Return to Index