[英]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: 在不知道所涉及的确切步骤的情况下,我将执行以下操作:
Error Establishing A Database Connection
我认为“关闭”表示没有数据库,因此该站点无法使用,因此请在核心WP文件中搜索生成错误的脚本,该Error Establishing A Database Connection
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.