Code to block specific bot
I have two questions on the following code provided by an AI tool to block bots (in this example Bytespider or zhanzhang.toutiao.com):
RewriteEngine On
RewriteCond %{HTTP_REFERER} zhanzhang\.toutiao\.com [NC]
RewriteRule .* - [F]
1. Is the above syntax correct?
2. Can I insert the code either at the very top or bottom of the .htaccess file?
-
Hey there! That should work well, just ensure you include it in the IfModule block like this: RewriteEngine On RewriteCond %{HTTP_REFERER} zhanzhang\.toutiao\.com [NC] RewriteRule .* - [F]
You would want to place this above any cPanel-generated PHP entries at the bottom of the file, but below any general site rewrite rules, such as those added by WordPress.0 -
Thanks @cPRex. 0 -
Sure thing! 0
Please sign in to leave a comment.
Comments
3 comments