Powered by Blogger.

Contact

Popular Posts

Saturday 7 September 2013




.htaccess made easy

If you want to block tough proxies like hidemyass.com, my previously posted .htaccess methods won’t work. Those methods will block quite a bit of proxy visits to your site, but won’t work on the stealthier proxies. Fortunately, we can use a bit of PHP to keep them out.

Block Tough Proxies with PHP

To stop tough proxy visits from sites like hidemyass.com, add the following slice of finely craftedPHP to the top of your header.php file:
<?php if(@fsockopen($_SERVER['REMOTE_ADDR'], 80, $errstr, $errno, 1))
die("Proxy access not allowed"); ?>
If you’re not using WordPress, just place the code at the top of your web page(s). No editing is necessary, so just add the code, upload the file, and done. You can check that it works by visiting your site via your favorite proxy service. If it works, access will be denied.
This method works for me on a Linux server running Apache 2.2.3, MySQL 5.0, and PHP 5.2.6. It should work on similar setups as well, but your results may vary depending on your server configuration.

Block Other Proxies with .htaccess

If for whatever reason you aren’t using the above PHP method, you can still block a majority of the “lesser” proxies by adding the following block of HTAccess code to your site’s root .htaccess file:
# BLOCK PROXY VISITS
# PerishablePress.com: http://bit.ly/12k6Uo
<ifModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP:VIA} !^$ [OR]
RewriteCond %{HTTP:FORWARDED} !^$ [OR]
RewriteCond %{HTTP:USERAGENT_VIA} !^$ [OR]
RewriteCond %{HTTP:X_FORWARDED_FOR} !^$ [OR]
RewriteCond %{HTTP:PROXY_CONNECTION} !^$ [OR]
RewriteCond %{HTTP:XPROXY_CONNECTION} !^$ [OR]
RewriteCond %{HTTP:HTTP_PC_REMOTE_ADDR} !^$ [OR]
RewriteCond %{HTTP:HTTP_CLIENT_IP} !^$
RewriteRule .* - [F]
</ifModule>
This proxy-blocking technique is less-effective than the PHP method, but should help reduce overall proxy traffic to your site. Using HTAccess to filter proxies requires fewer system resources than the PHP method. So if you get tons of traffic or have lots of pages, you’re better off sticking with the HTAccess technique. It’s sort of a trade-off between effective proxy-blocking and optimum performance, which will vary depending on your needs and server configuration.

1 comment:

  1. Very important article for online user. Advert networks use Luminati to anonymously view their advertisers' touchdown pages to make sure they do not comprise malware, or improper promoting.luminati is the biggest proxy community on the planet that is present proxy service, shared proxy,residential proxy extra then 223 Сountries,26,846 Cities. If advert networks used a daily server primarily based popular shared proxy community, the malicious advertiser would know he is being checked, and will cloak them with a special message.One easy interface to entry Luminati's Residential IP community, Datacenter Shared Proxies, Non-public Proxies, and Cell proxy community.Retailers worth their merchandise algorithmically relative to competitor’s pricing.I know about set default proxy enable the code is <defaultProxy enabled="true"They use the Luminati proxy to scrape this information with out being blocked or deceived.Advert networks use Luminati to anonymously view their advertisers' touchdown pages to make sure they do not comprise malware, or improper promoting. If advert networks used a daily server primarily based popular community, the malicious advertiser would know he is being checked, and will cloak them with a special message.

    ReplyDelete