开发者

Make specific url response 404 error instead of 200 for spam bots

开发者 https://www.devze.com 2023-04-01 19:17 出处:网络
How to make my site\'s specific url (index.php?act=add) to response 404 error instead of 200 when spam bots try to access it ?

How to make my site's specific url (index.php?act=add) to response 404 error instead of 200 when spam bots try to access it ?

I am not php programmer so may be it could be done somehow with derectives in .htaccess file ?

++++

Thank you for your answers but that did not help (

I need somthing like that rule in .htaccess file:

 <Files "index.php">
 Order Deny,Allow
 Deny from all
 </Files>

But instead of index.php to use "开发者_运维问答index.php?act=add".

+++ Now its working. Thank you!!!


using php (file index.php)

if ($_GET['act'] == 'add') {
    if (condition to check spambot/useragent/ipaddress/cookie) {

        header("HTTP/1.0 404 Not Found");
        exit;

    } else {

        //
        //
        // your code for 'REAL' users

    }
}


you can use php headers

<?php
header("HTTP/1.0 404 Not Found");
?>

or use htaccess


You can use header() function, for example

if ($_GET["act"] == "add"){    
  header("HTTP/1.0 404 Not Found");
}
0

精彩评论

暂无评论...
验证码 换一张
取 消