【发布时间】:2020-06-07 18:48:27
【问题描述】:
一旦我的 joomla 网站关闭,我该如何重定向到另一个网站。
例如。
**http://localhost:8081/site** (it is orginal site)
如果它显示“页面无法显示”它应该会自动重定向到另一个站点
**http://localhost:8081/site1** (secondary site)
我试过了
<?php
header("http://localhost:8081/site/"); /*LIVE VERSION*/
function Redirect($http://localhost:8081/site/, $permanent = false)
{
if (headers_sent() === false)
{
header('Location: ' . $http://localhost:8081/site/, true, ($permanent === true) ? 301 : 302);
}
exit();
}
Redirect('http:http://localhost:8081/site1/', false);
die();
?>
但它不适合我。
【问题讨论】:
-
function Redirect($http, $permanent = false)和header('Location: ' . $http,..和Redirect('http://localhost:8081/site1/', false);试试这样。 -
它可以工作,但是,它在两种情况下都可以工作,如果原始站点启动,它会重定向到辅助站点,如果原始站点关闭,它也会移动到辅助站点。一旦原始站点停止工作,我就需要。 ,这意味着一旦原始站点显示页面无法显示或任何其他错误,它应该移动到辅助站点,否则保留在原始站点中。
标签: php joomla joomla2.5 joomla3.0