Q: How can I restrict access to one of my web pages from certain domains?


First, you must create a subdirectory within ~/public_html in which files of web pages whose access is to be restricted will be located. That directory must be at least executable by ``others'' and the files in it must be at least readable by ``others.''

In that subdirectory, create a file called .htaccess (that is readable by ``others'' as well). The content of that file depends on whether you want to block most sites and allow only a few trusted ones, or allow most and block only a few annoying ones.

In the former case, put the following in it (without the indentation):


	<Limit GET>
	Order deny,allow
	Deny from all
	Allow from DOMAINS
	</Limit>

In the latter case, put the following in it (without the indentation):

	<Limit GET>
	Order allow,deny
	Deny from DOMAINS
	Allow from all
	</Limit>

In either case, replace DOMAINS with the appropriate (space delimited) list of site information (host name, domain name, partial domain name, IP address, IP address range, etc). For an example, see the files /website/.htaccess and /website/internal/.htaccess on WWW (from the UNIX command line).

The access restriction will apply recursively to subdirectories within the subdirectory where the .htaccess file is located, unless they have their own .htaccess file (in which case theirs will be used instead).

For more details, see the Apache web server specific authentication information.