Knowledge Base Navigation

Articles: 51 Categories: 8

KB Article: Denying access with .htaccess

Article:Denying access with .htaccess     Popular
Submitted By:Telli
Date Added:04-27-2004 5:32:18
Hits:6,882



Denying access with .htaccess

Every directory protected this way should have an index.html file that is given out when a request is made for a list of files in the directory. Without that file, a request for the directory will list all of the files in the directory.
Create a file named .htaccess within your directory (note the leading period). This file is consulted by the Web server to determine whether or not to allow access.

AuthType Basic


<Limit GET>
order deny,allow
deny from all
allow from .domain.co.uk
allow from .domain.com
</Limit>


or

<Limit GET>
order allow,deny
deny from 124.24.41
deny from 205.158.256.213
allow from all
</Limit>


In the case of the example .htaccess file (above) which restricts access to domain.co.uk and domain.com addresses, only hosts which have a valid domain name registered in the Domain Name System (DNS) will be allowed access. If you wish to also allow access to U-M hosts without a DNS entry, you can include the following lines in the .htaccess file (in addition to the existing lines in the example):

allow from 195.112
allow from 195.113
allow from 195.114

These additional lines must be after the order directive and before the tag.

Current rating: 8.68 by 99 users
Please take one second and rate this article...

Not a Chance 12345678910 Absolutely

Please register or sign-in to post comments.


Jump to a selected article...