Menu Close

Stop 404 requests from spammers and bots!

Ok, I’m very fed up with lots of 404 in my stats.

Spammers and bots try every second make a request to my domain with wrong domain and junk links:



So I found a simple solution for stop this situation.

I modified my htaccess file with:

# Block all request different from my domain
RewriteCond %{HTTP_HOST} !^(www\.)?smartdomotik\.com 
RewriteRule (.*)$1 [R=301,L]

With these simple 3 lines in htaccess i blocked all spam requests that have wrong domain name.

If you try to send a request with wrong domain, it will come back to your localhost!


And if bots try if your domain is a proxy, you can force the request to localhost:

RewriteCond %{REQUEST_URI} http: [OR]
RewriteCond %{REQUEST_URI} http/ [OR]
RewriteCond %{REQUEST_URI} azenv.php [OR]
RewriteCond %{REQUEST_URI} proxy.php 
RewriteRule (.*) [R=301,L]
Posted in Linux, News, Web Development

Leave a Reply

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