htaccess Generator

Use this tool to generate .htaccess files to control access to websites.

Your IP address is 172.69.58.242

Valid IP Addresses

IP addresses are in the form xxx.xxx.xxx.xxx and each of these four numbers is from 0-255.
You can enter partial addresses to restrict larger blocks of addresses:

1.2.3.4 Blocks one specific IP address
1.2.3. Blocks IP address in the range 1.2.3.0 to 1.2.3.255 (ie.. 1.2.3.xxx)
1.2. Blocks IP address in the range 1.2.xxx.xxx
1.2 Blocks IP address in the range 1.2xx.xxx.xxx
Warning: Be careful when blocking blocks of IPs as you might be blocking legitimate traffic!

Restrict by IP address

You can use .htaccess to ban or allow access to your web site by IP address.

This is only needed if:
  • Your .htaccess file is in a web accessible directory
  • Your server isn't configured to disable browser access to .htaccess (this is not common)

Generated .htaccess Code

Apache 2.4

Apache 2.2

296,145 page views since Jul 2011.