区块链技术资源分享
追寻中本聪先生的脚步

wordpress404页面自动301跳转到首页 返回状态码并跳转-iP反查域名网站

使用方法,选择以下代码添加到 文章的404页面 (404.php)

第一种,直接跳转

  1. <?php
  2. header("HTTP/1.1 301 Moved Permanently");
  3. header("Location: ".get_bloginfo("url"));
  4. exit();
  5. ?>

第二种,直接跳转

  1. <?php
  2. //WordPress 301 跳转到网站首页
  3. wp_redirect(home_url(), 301);exit;
  4. ?>

第三种,直接载入首页 返回 404 状态

  1. <?php
  2. //直接载入首页 返回 404 状态
  3. global $wp_query;
  4. $wp_query->set_404();
  5. status_header(404);
  6. nocache_headers();
  7. include( get_query_template( 'index' ) );
  8. die();
  9. ?>

第四种,返回 404 状态,然后通过 html 刷新跳转到首页

  1. <?php
  2. //返回 404 状态,然后通过 html 刷新跳转到首页
  3. global $wp_query;
  4. $wp_query->set_404();
  5. status_header(404);
  6. nocache_headers();
  7. echo '<meta http-equiv="refresh" content="0;url='.home_url().'">';
  8. exit;
  9. ?>

https://www.zmki.cn/5722.html


iP反查域名网站

https://site.ip138.com/


屏蔽垃圾蜘蛛

在网站 配置文件修改。

if ($http_user_agent ~* (SemrushBot|python|Linespider|crawler|DingTalkBot|simplecrawler|ZoominfoBot|zoombot|Neevabot|coccocbot|Facebot|YandexBot|Adsbot|DotBot|Applebot|DataForSeoBot|MJ12bot|BLEXBot|trendictionbot0|trendictionbot|AhrefsBot|hubspot|opensiteexplorer|leiki|webmeup)) { 
	return 444;
}

if ($http_user_agent ~* (SemrushBot|DotBot|MJ12bot|AhrefsBot|MauiBot|MegaIndex.ru|BLEXBot|ZoominfoBot|ExtLinksBot|hubspot|leiki|webmeup)) {
return 403;
}
分享到:更多 ()
靠谱免费最好的手机挖矿app推广 炒币圈交易所注册链接 手机挖矿微信群联系方式

来评论吐槽 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

快手号:神吐槽shentucao

交易所地址更多手机免费挖矿APP