我的网络服务器中的一些文件正在返回Error 520: Web server is returning an unknown error
。据我所知,返回错误的文件是index.php
和google0f3d9b***.html
(用于验证 Google 网站管理员控制台)。
以下是我的.htaccess
文件:
RewriteBase /
# Force non-www version
RewriteCond %{HTTP_HOST} ^www\.yikjin\.ga [NC]
RewriteRule ^(.*)$ https://yikjin.ga/$1 [L,R=301]
# Prevent 000webhost ads from poping up
php_value auto_append_file none
# Prevent directory listing
Options -Indexes
# Make index.php default
DirectoryIndex index.php
Run Code Online (Sandbox Code Playgroud)
和我的index.php
:
<!DOCTYPE html>
<html>
<head>
<!-- ... -->
</head>
<body>
<header>
<img src="/drawable/images/me.jpg" width="6%" alt="That's us!" title="That's us!">
<span>Welcome to Cards!</span>
</header>
<div id="login">
<img src="/drawable/images/cards.jpg" alt width="40%" height="auto">
<h2 id="welcome">Welcome back,<br/>
<span id="user">user</span>
</h2>
<h4>Please re-enter your password</h4>
<form method="post">
<label for="userid">Username</label>
<br/>
<input type="text" title="What's your username?
eg. johntan" id="userid" name="userid" required>
<br/>
<span id="user-err"></span>
<br/>
<label for="pass">Password</label>
<br/>
<input type="password" title="What's your password?
eg. *****" id="pass" name="pass" required>
<br/>
<span id="pass-err"></span>
<br/>
<input type="button" value="‹ Back" onclick="javascript:window.history.back();">
<input type="submit" value="Continue ›" name="login">
<a href="#" target="_blank">Not you?</a>
</form>
<br/>
<a href="/register.php">Register now</a>
</div>
<link href="/drawable/css/design.css" type="text/css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300" type="text/css" rel="stylesheet">
<!-- Begin Cookie Consent -->
<script type="text/javascript">
window.cookieconsent_options = {"message":"We love cookies. So we use them. :D","dismiss":"Got it!","learnMore":"Whyyy...","link":null,"theme":"dark-bottom"};
</script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/1.0.9/cookieconsent.min.js"></script>
</body>
</html>
<?php
include("/drawable/connect.php"); /* $dbcon is from this file */
if (isset($_POST['login'])) {
$userid = $_POST['userid'];
$pass = $_POST['pass'];
$check_user = "SELECT * FROM login WHERE userid = '$userid' AND password = '$pass'";
$user_query = mysqli_query($dbcon, $check_user);
if (mysqli_num_rows($user_query)) {
$_SESSION['user'] = $userid;
header("Location: welcome.php");
}
else {
echo "<script>alert('Invalid credentials supplied; please retry');</script>";
}
}
?>
Run Code Online (Sandbox Code Playgroud)
我认为这是我的文件的问题.htaccess
,但我似乎无法弄清楚是什么。我使用 000webhost 作为我的 Web 服务器和 Cloudflare。我网站的链接是yikjin.ga。我可以知道是什么原因导致网站无法运行吗?提前致谢!
正如 CloudFlare 文档中引用的那样:
\n\n\n\n\n520 错误本质上是 \xe2\x80\x9ccatch-all\xe2\x80\x9d 响应。
\n
这可能是由以下情况引起的:
\n\n\n\n\n当 CloudFlare 无法与 website\xe2\x80\x99s 源服务器建立 TCP 连接时,会返回 522 错误响应。
\n
这可能是由以下情况引起的:
\n\n对于您的情况,很可能是服务器超时或 DB CONN 有问题。您可以尝试将 DB CONN 移动到文件中而不是包含它。
\n\n建议在开发时关闭 CloudFlare,以便更轻松地诊断站点的任何问题。
\n