!
也想出现在这里? 联系我们
广告位
当前位置:首页>教程分享>网站教程>网站检测UA跳转指定404页面禁止访问 蜘蛛正常抓取

网站检测UA跳转指定404页面禁止访问 蜘蛛正常抓取

1、网站页面中插入以下代码,可直接将不需要指定UA访问的页面插入以下代码,或者将代码插入公共页面头部或者尾部代码中

<script>
var system = {
win: false,
mac: false,
xll: false
};
var p = navigator.platform;
var us = navigator.userAgent.toLowerCase();
system.win = p.indexOf("Win") == 0;
system.mac = p.indexOf("Mac") == 0;
system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);
if (system.win || system.mac || system.xll) {
var iframe_url='/addons/404.htm';
$("title").html('404');
$("head").append('<style>body{position:static !important;}body *{ visibility:hidden; }</style> ');
$("body").empty();
$(document).ready(function () {
$("body").html('<iframe style="width:100%; height:100%;position:absolute;margin-left:0px;margin-top:0px;top:0px;left:0px;" id="mainFrame" src="'+iframe_url+'" frameborder="0" scrolling="no"></iframe>').show();
$("body *").css("visibility", "visible");
});
}
</script>

2、在网站根目录中新建目录addons,在其目录下新建html页面404.htm,插入以下404页面代码,或者自定义代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>网站访问报错</title>
<style type="text/css">
* { padding:0; margin:0;}
li { list-style:none;}
img { border:none;}
.clear { zoom:1;}
.clear:after { content:''; clear:both; display:block;}
.error-page { width:940px; margin:0 auto; padding-top:110px;}
.error-page-right { width:500px; float:left;}
.error-page-right h3 { line-height:114px; font-size:22px; color:#333; font-weight:600; padding-top:10px;}
.error-page-title { line-height:24px; font-size:14px; color:#333;}
.error-page-title a { color:#0066cc; text-decoration:underline;}
.error-page-txt { line-height:24px; padding-left:40px; font-size:14px; color:#333; padding-bottom:9px;}
.error-page-txt a { color:#0066cc; text-decoration:underline;}
</style>
</head>
<body>
<div class="error-page">
<div class="error-page-left">&nbsp;</div>
<div class="error-page-right">
<h3>抱歉!该网站可能由于以下原因无法访问!</h3>
<p class="error-page-title">&gt;&gt;1、您访问的域名未绑定至主机;</p>
<p class="error-page-txt">解决方法:需要网站管理员登录<a href="https://cp.hichina.com/" target="_blank">万网主机控制面板</a>绑定域名,阿里云账号请登录<a href="https://netcn.console.aliyun.com/core/host/list2" target="_blank">阿里云虚拟主机控制台</a>绑定。</p>
<p class="error-page-title">&gt;&gt;2、您正在使用IP访问;</p>
<p class="error-page-txt">解决方法:请尝试使用域名进行访问。</p>
<p class="error-page-title">&gt;&gt;3、该站点已被网站管理员停止;</p>
<p class="error-page-txt">解决方法:需要网站管理员登录<a href="https://cp.hichina.com/" target="_blank">万网主机控制面板</a>开启站点,阿里云账号请登录<a href="https://netcn.console.aliyun.com/core/host/list2" target="_blank">阿里云虚拟主机控制台</a>进行开通。</
</div>
</div>
</body>
</html>

给TA打赏
共{{data.count}}人
人已打赏
网站教程

免费的域名 免费申请域名

2021-6-5 23:41:24

服务器教程

报错原因:8080端口被占用

2021-4-17 19:31:54

声明 本站上的部份代码及教程来源于互联网,仅供网友学习交流,若您喜欢本文可附上原文链接随意转载。无意侵害您的权益,请发送邮件至 [email protected] 或点击右侧 私信:吉吉国王 反馈,我们将尽快处理。
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索
OneEase