我的网络服务器中的部分文件正在返回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
和我的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>";
}
}
?>
我认为我的.htaccess
文件存在问题,但我似乎无法弄清楚是什么。我使用000webhost作为我的网络服务器和Cloudflare。我网站的链接是yikjin.ga。我可以知道导致网站无法正常工作的原因吗?提前谢谢!
答案 0 :(得分:1)
引自CloudFlare的文档:
520错误本质上是一种“全能”反应。
可能由以下情况引起:
来源:CloudFlare Error 520 Documentation
当CloudFlare无法与网站的原始服务器建立TCP连接时,会返回522错误响应。
可能由以下情况引起:
来源:CloudFlare Error 522 Documentation
对于您的情况,很可能是服务器超时或DB CONN有问题。您可以尝试在文件中移动DB CONN而不是包含它。
建议在开发时关闭CloudFlare,以便更轻松地诊断您网站的任何问题。