If you ever wanted to prevent certain IP addresses from accessing your site, you can easily acheive this in the .htaccess file.

Simply list the IP addresses and then redirect them to the desired URL:

RewriteEngine on 
RewriteCond %{REMOTE_ADDR} ^xxx\.xxx\.xxx\.xxx$ [OR]
RewriteCond %{REMOTE_ADDR} ^xxx\.xxx\.xxx\.xxx$
RewriteRule ^(.*)$ http://www.redirection-url.com [L]

If you want to add more then do so, but notice there is no [OR] on the last condition.

Now, this could get messy if you have loads, and I am unsure of the performance hit, but its a quick and easy way of redirecting users. A site I work on has 5 servers located worldwide, and I wanted to send LA users attempting to access the UK server back to their designated server

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.