


网站是WordPress程序做的,被爆出现非法信息,但检查是一个正规的企业站,也并未发现任何非法信息,通过访问地址看是程序被别人使用非法关键字恶意搜索了,下面将介绍WordPress屏蔽搜索功能方法
将如下代码添加到模板的公共文件最上方即可,添加后别人使用搜索功能时程序会自动过滤掉?号,来达到禁用搜索功能的目的
- <?php
- $the_host = $_SERVER['HTTP_HOST'];
- $the_url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
- $the_url = strtolower($the_url);
- $pos = strpos($the_url, "?");
- if($pos !== false)
- {
- header('HTTP/1.1 301 Moved Permanently');
- header('Location:http://blog.tag.gg/');//可以设定您需要跳转的地址
- }
- ?>




亲爱的:若该文章解决了您的问题,可否收藏+评论+分享呢?
文章评论 本文章有个评论