How To Restrict A Series Of IP Address Using .htaccess

Htaccess is the default configuration file that manages your web server and its quite a very important file to be kept safer. I am not gonna teach you how to protect, rather a little information on how to restrict a set of IP (Internet Protocol) from accessing your blog. There are two important things that comes in my mind to restrict IP’s. At first to prevent someone’s IP whom you find suspicious and then to prevent spam comments that comes from a series of IP. Since I found these two points pretty important, I though its better to write about it.

Before getting into the tutorial take a backup of your .htaccess file. You can find the file placed in the file manager of your domain.

Restrict Multiple IP Address
order deny,allow
deny from 12.23.34.56
deny from 45.67.78.90
allow from all

Follow the same process if you want to deny single IP address.

Since most of us are not using static IP’s and hence its better to deny a series of IP. So follow the step below to prevent a series of IP’s accessing our blog or website.

Restrict a series of IP address
order deny,allow
deny from 23.45.56
allow from all

Note : While using the above code DON’T leave white space after comma.

July 15, 2010. This entry was posted in Tutorials, WordPress and tagged . Bookmark the permalink.

We Recommend HostGator Hosting

Bloggermint strongly recommends Hostgator Hosting for all of your web hosting needs. Sign up today for WordPress Hosting at just $4.95/month.

Use coupon code "bloggermint" to get 25% discount on any hosting packages. Get an account with Hostgator now!