如果是非正常URL则显示404并退出if $s === rt_log_errorbad guy short_url $short_url; echo 404; echo br; echo a href=indexphp 点这里返回首页a; exit;修改上面这段代码使其不对首页起作用
您可以使用以下代码修改上述代码,使其不对首页起作用:
// 如果是非正常URL,并且不是首页,则显示404并退出
if ($s === '' && $_SERVER['REQUEST_URI'] != '/') {
rt_log_error('bad guy short_url: '.$short_url);
echo '404'; echo "<br>"; echo "<a href='index.php' >点这里返回首页</a>";
exit;
}
这样,只有当 $s 为空且请求的 URL 不是首页时,才会显示404并退出。
原文地址: https://www.cveoy.top/t/topic/hTGr 著作权归作者所有。请勿转载和采集!