Information on .htaccess
Limiting Number of simultaneous connections
To limit the number of simultaneous connections to a directory or your entire site, use the below line. If you place it in a directory other than the root directory, then it will limit the connections to that directory and its sub-directories only. Placing it in htaccess file of root directory will implement it for entire site.Syntax:
MaxClients < number-of-connections>
Examples:
MaxClients 40
MaxClients 100
Allow/Disallow certain visitors from accessing your site
To accomplish it use the following lines. Look at the syntax first:Syntax:
Order allow,deny
Deny from < incoming -address >
Allow from < incoming -address>
The first line [Order allow,deny] tells what should be done first. The second line tells about denying incoming-addresses [could be a single IP, an IP block, domain name and all] and third line tells about the incoming-addresses [could be a single IP, an IP block, domain name and all] those should be allowed. If second line has ‘Deny all’, then you should change the order of allow,deny in the first line to deny,allow.
To deny access to a single IP address and allow everyone else
Order allow,deny
Deny from 100.100.100.1
Allow from all
To deny a block of IP address and allow everyone else. [Notice the second line]
Order allow,deny
Deny from 100.100.100.
Allow from all
To deny a single IP address and allow everyone else. [Use it to block referrals from a specific domain]
Order allow,deny
Deny from www.my-domain.com
Allow from all
To deny everyone else but yourself. [Notice the order of allow,deny has changed in first line and also appending more 'Allow from' lines at the end, which is valid]
Order deny,allow
Deny from all
Allow from < your-ip-address >
Allow from < another-ip-address >
Allow from < www.domain.com>
Specify Administrator’s email address in error message
Using the line below in your htaccess file will display the conerned system administrator’s email address in the error messages. If you are not using custom pages for error messages, then this will help your visitors drop an email and let you know about problems.Syntax:
ServerAdmin < a-valid-email-address>
Example:
ServerAdmin name@domain.com
Comments
Post a Comment