99 行
5.0 KiB
PHP
99 行
5.0 KiB
PHP
<?php
|
||
|
||
/**
|
||
* This is the 404-handler for Apache and PHP (see README).
|
||
* It is typically served from wiki domains for urls outside
|
||
* the scope of MediaWiki.
|
||
*/
|
||
header('Content-Type: text/html; charset=utf-8');
|
||
header('Cache-Control: s-maxage=600, max-age=600');
|
||
|
||
$url = $_SERVER['REQUEST_URI'];
|
||
$encUrl = htmlspecialchars($url);
|
||
$decUrl = htmlspecialchars(urldecode($url));
|
||
|
||
if (
|
||
preg_match('/(%2f)/i', $url, $matches)
|
||
|| preg_match('/^\/(?:w|wiki|extensions|skins)\/(.*)/i', $url, $matches)
|
||
) {
|
||
// "/w/Foo" -> "/wiki/Foo"
|
||
$target = '/wiki/' . $matches[1];
|
||
} elseif (preg_match('/^\/(qiuwen|qw|wp|help|h|special|file|image|media|template|t|module)(:|:)(.*)/i', $url, $matches)) {
|
||
// "/qw:Foo" -> "/wiki/qw:Foo"
|
||
$target = '/wiki/' . $matches[1] . ':' . $matches[3];
|
||
} elseif (preg_match('/^\/(?:wiki)(.*)/i', $url, $matches)) {
|
||
// "/wikiFoo" -> "/wiki/Foo"
|
||
$target = '/wiki/' . $matches[1];
|
||
} else {
|
||
// "/Foo" -> "/wiki/Foo"
|
||
$target = '/wiki' . $url;
|
||
}
|
||
$encTarget = htmlspecialchars($target);
|
||
$decTarget = htmlspecialchars(urldecode($target));
|
||
|
||
$today = getdate();
|
||
$year = $today['year'];
|
||
|
||
$outputHtml = <<<END
|
||
<!DOCTYPE html>
|
||
<head>
|
||
<meta charset="UTF-8"/>
|
||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||
<link rel="sourcecode" href="https://git.qiuwen.net.cn/qiuwen/qiuwen-errorpages">
|
||
<link rel="copyright" href="https://creativecommons.org/licenses/by-sa/4.0/">
|
||
<link rel="license" href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">
|
||
<link rel="icon" href="/favicon.ico">
|
||
<title>HTTP 404 页面未找到 - 求闻百科,共笔求闻</title>
|
||
<style>
|
||
*{margin:0;padding:0}
|
||
html{width:100%;background:#fff;color:#000;font-family:"Noto Serif","Source Serif","Noto Serif SC","Source Han Serif SC",Times New Roman,Times,STSong,SimSun,serif;line-height:1.75}
|
||
body,html{min-height:100vh}
|
||
body{display:flex;margin:0 auto;max-width:83vw;flex-wrap:wrap;flex-direction:column;justify-content:space-between}
|
||
header{margin:10vh 0 0;padding-bottom:1em;border-bottom:5px solid #36c}
|
||
a img{border:0}
|
||
main{display:flex;margin:0 auto;min-width:70vw;flex-wrap:wrap;flex-direction:column}
|
||
h1{margin-top:.5em;margin-bottom:.5em;font-size:1.25em}
|
||
p{margin:.5em 0}
|
||
a{color:#36c;text-decoration:none}
|
||
a:hover{text-decoration:underline}
|
||
em,footer{color:#777;font-style:normal}
|
||
footer{margin:0 0 10vh;padding-top:1em;border-top:1px solid #eaecf0;font-size:.9em}
|
||
.footer-links a{margin-right:.5em;white-space:nowrap}
|
||
footer .footer-buttons{display:flex;margin-top:.5em;gap:.5em;flex-wrap:wrap;flex-direction:row;justify-content:flex-end}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<header>
|
||
<a href="https://www.qiuwenbaike.cn" title="求闻百科">
|
||
<img src="https://tu.zhongwen.wiki/resources/assets/qiuwen/wordmark/wordmark-favicon-tagline-horizonal.png?_20240225" width="238" height="35" alt="求闻百科,共笔求闻">
|
||
</a>
|
||
</header>
|
||
<main>
|
||
<h1>页面未找到<em>(HTTP 404)</em></h1>
|
||
<p><em>$decUrl</em></p>
|
||
<p>很抱歉,我们未能找到您所访问的网址。<br><strong>您是否想要访问:<a href="$encTarget">$decTarget</a>?</strong></p>
|
||
<p>您也可以返回<a href="/">首页</a>。</p>
|
||
</main>
|
||
<footer>
|
||
<div class="footer-copyright">
|
||
<p>© 2021-$year 无锡共笔全书网络有限责任公司</p>
|
||
<p>求闻®、求闻百科®、共笔全书®、“绿竹”图标等文字、图形、图文组合,均是本网站运营者或其关联实体的商标或注册商标。</p>
|
||
</div>
|
||
<div class="footer-links">
|
||
<a class="qwlink qwlink-about" href="https://www.qiuwenbaike.cn/wiki/Qiuwen:%E5%85%B3%E4%BA%8E%E6%B1%82%E9%97%BB%E7%99%BE%E7%A7%91" rel="noreferrer noopener" target="_blank">关于“求闻”</a>
|
||
<a class="qwlink qwlink-tos" href="https://www.qiuwenbaike.cn/wiki/Qiuwen:%E7%94%A8%E6%88%B7%E5%8D%8F%E8%AE%AE" rel="noreferrer noopener" target="_blank">用户协议</a>
|
||
<a class="qwlink qwlink-pipp" href="https://www.qiuwenbaike.cn/wiki/Qiuwen:%E4%B8%AA%E4%BA%BA%E4%BF%A1%E6%81%AF%E4%BF%9D%E6%8A%A4%E6%96%B9%E9%92%88" rel="noreferrer noopener" target="_blank">隐私保护</a>
|
||
<a class="govlink govlink-icp" href="https://beian.miit.gov.cn/" rel="noreferrer noopener" target="_blank">苏ICP备2022013164号</a>
|
||
<a class="govlink govlink-ga" href="http://www.beian.gov.cn/" rel="noreferrer noopener" target="_blank">苏公网安备32021302000963号</a>
|
||
</div>
|
||
<div class="footer-buttons">
|
||
<a href="https://www.qiuwenbaike.cn" title="“求闻”计划网站" target="_blank" rel="noopener noreferrer"><img alt="“求闻”计划网站" width="88" height="31" src="https://tu.zhongwen.wiki/resources/assets/qiuwen/button/qiuwen-button.png"></a>
|
||
<a href="https://www.gongbiquanshu.cn" title="共笔全书旗下网站" target="_blank" rel="noopener noreferrer"><img alt="共笔全书旗下网站" class="img" width="88" height="31" src="https://tu.zhongwen.wiki/resources/assets/qiuwen/button/gbqs-button.png"></a>
|
||
</div>
|
||
</footer>
|
||
</body>
|
||
</html>
|
||
END;
|
||
|
||
print $outputHtml;
|