简体   繁体   English

如何确定Wordpress何时关闭并重定向到另一个站点

[英]How can I determine when Wordpress is down and redirect to another site

I've been reading Stackoverflow for many years but this is the first time I ask a question. 我已经阅读Stackoverflow多年了,但这是我第一次问一个问题。

I want to determine when a Wordpress site (www.first-domain.ro) is down (by Wordpress itself or Wordpress plugin problem) and then to redirect the user to a new site (www.second-domain.ro). 我想确定某个Wordpress网站(www.first-domain.ro)何时关闭(由Wordpress本身或Wordpress插件问题引起),然后将用户重定向到一个新网站(www.second-domain.ro)。 I whant this to happen only is a problem with the site, otherwise user should stay on first site. 我希望这种情况只发生在网站上,否则用户应该留在第一个网站上。

By "down" I mean that the site is not working because wordpress or a plugin generates an error preventing wordpress to load properly. “关闭”是指该网站无法正常运行,因为wordpress或插件会生成错误,导致无法正确加载wordpress。

I have been reading on google and find nothing. 我一直在谷歌上阅读,却一无所获。 Also on stackoverflow I find this Redirect to another site page if site one is down but I can't figure out how can be implemented on wordpress. 同样在stackoverflow 上,如果站点1处于关闭状态 ,我会发现此重定向到另一个站点页面,但是我不知道如何在wordpress上实现。

Thanks for you all! 谢谢大家!

Without knowing the exact steps involved, here's what I would do: 在不知道所涉及的确切步骤的情况下,我将执行以下操作:

  1. I assume 'down' means no database so the site cannot be used, so search the core WP files for the script that generates the error Error Establishing A Database Connection 我认为“关闭”表示没有数据库,因此该站点无法使用,因此请在核心WP文件中搜索生成错误的脚本,该Error Establishing A Database Connection
  2. Replace the generation of that error with header('Location: http://yourothersite.com'): header('Location: http://yourothersite.com'):替换该错误的生成header('Location: http://yourothersite.com'):

There are pre-existing plugins that allow you to modify the error message on the White Screen of Death . 有一些预先存在的插件,可让您修改“ 死亡白屏”上的错误消息。 I assume you could modify one of those plugins to redirect instead of changing the message. 我假设您可以修改这些插件之一来重定向,而不用更改消息。

Here is the WordPress redirect function ... 这是WordPress重定向功能 ...

wp_redirect( $url );
exit;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在WordPress网站上删除302重定向? - How can I remove a 302 redirect on a WordPress site? 在维护模式下,如何将Drupal重定向到另一个站点 - How do I redirect drupal to another site when in maintenance mode 将 wordpress 网站重定向到另一个网站 - Redirect wordpress website to another site 如何让我的 WordPress 网站在成功登录后重定向到子域,它们将重定向回根域 - How can I make my WordPress site redirect to subdomain once successfully login they will redirect back to root domain 如何使用当前站点cookie登录到另一个站点,然后重定向到另一个页面并发出CURL请求? - How can I use current site cookies to login to another site and then redirect to another page and make a CURL request? 如何使用其REST API在另一个wordpress网站中创建wordpress发布? - How can I create a wordpress post in another wordpress site using their REST API? 如何将未登录Wordpress网站的用户重定向到特殊的登录页面? - How can I redirect users who are not logged in to my Wordpress site to a special login page? 如何重定向到WordPress网站? - how to redirect out of a wordpress site? Wordpress:如何在没有权限的情况下尝试访问网站时重定向 - Wordpress: How to redirect when trying to access a site without permissions 如何使用 PHP 或 JavaScript 根据地理位置或 IP 将访问者重定向到另一个站点? - How can I redirect visitors to another site based in geographical location or IP using PHP or JavaScript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM