Search articles


Search in titles
Search in article texts

Docs Navigation





How Do I Ban/Deny Users Via .htaccess?

Started by Xarcell, April 25, 2008, 04:12:36 AM

Previous topic - Next topic

Xarcell

This is a draft of a how to on banning. Let me know what you guys think. I pretty copied alot of the info from another guide at my host.




Ban User's Via SMF

If you wish to ban a user by IP, domain, email, or just username this can be done in the SMF settings. You can also ban users temporally

Just go to "Admin > Ban List" in your SMF installation.




Deny/Allow Certain IP Addresses From Your Domain Via ".htaccess".
If you have problems with certain visitors to your website, you can easily ban them through your .htaccess file. Most likely your site already has a .htaccess file in a web root, folder, or subfolder.

However this file is hidden and be made visible through your FTP client, depending on which FTP you use. You will need to check with your FTP program and guides for it to figure it out if you don't already know.

If you do not have a .htaccess file, you can create one.

Now, there are two different ways to ban visitors. This can be done using their IP address or with the domain name which they came from.

Example 1: to deny a user by their IP address.

Quoteorder allow,deny
deny from 201.68.101.5
allow from all

The above code will deny the 201.68.101.5 IP address and allow everyone else to enter. If you want to deny a block of IP addresses, use this code:

Example 2: to deny a user by block IP address.

Quoteorder allow,deny
deny from 201.68.101.
allow from all

The above code will deny the 201.68.101.0 IP address, the 201.68.101.5 IP address and all the way up to 201.68.101.255 or 255 IP addresses. Here's an example showing you how to deny a user by the domain name from which they came from:

Example 3: to deny a user by their domain address.

Quoteorder allow,deny
deny from www.theirdomain.com
allow from all

The above code will deny anyone coming from www.theirdomain.com and allow everyone else to enter. Here's an example showing you how to deny a user from a domain name and all subdomains within the domain name:

Example 4: to deny a user by their domain address & subdomain.

Quoteorder allow,deny
deny from .theirdomain.com
allow from all

The above code will deny anyone coming from www.theirdomain.com, all sub-domains within the domain and allow everyone else to enter.

Example 5: to deny all, except yourself.

QuoteOrder deny,allow
Deny from all
Allow from youripaddress

The above code will block all visitors from accessing your site except for yourself if you replace youripaddress with the IP address that was assigned to you by your ISP.



Doc Written By: Xarcell