当垃圾邮件机器人试图访问它时,如何使我的网站的特定url (index.php?act=add)响应404错误而不是200 ?
我不是php程序员,所以也许它可以用。htaccess文件中的导数来完成?
谢谢你的回答,但没有帮助(
我需要这样的规则在。htaccess文件中:
<Files "index.php">
Order Deny,Allow
Deny from all
</Files>
但是用"index.php?act=add"代替index.php。
+ + +现在它起作用了。谢谢你! !
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
}
}
可以使用PHP头文件
<?php
header("HTTP/1.0 404 Not Found");
?>
或者使用
可以使用header()函数,例如
if ($_GET["act"] == "add"){
header("HTTP/1.0 404 Not Found");
}