【发布时间】:2018-10-22 10:21:43
【问题描述】:
我安装了最新版本的 wordpress 和 woocommerce。过去几个月我面临的问题是,有时当我尝试从我的 Windows 10 笔记本电脑访问网站时,它会显示空白页 -
无论我在笔记本电脑上使用哪种浏览器,都会发生这种情况。我尝试使用 Chrome、Firefox 和 Edge。当我清除浏览器的历史记录和缓存时,我的网站开始正常加载。该问题会影响整个网站,包括管理部分、主页或任何其他页面。
由于某种原因,这个问题只出现在我的笔记本电脑上。我从来没有在我的安卓手机上遇到过这个问题。我什至检查了在我的手机和笔记本电脑上同时加载网站。虽然它在移动设备上正常加载,但我在笔记本电脑上遇到了同样的问题。
当页面显示为空白时,我决定检查该页面的源代码。在源代码中,我可以看到它显示错误“HTTP 错误 403 - 禁止访问。Web 服务器配置为不列出此目录的内容,或者您没有足够的权限访问该资源”.
源代码如下。有人可以告诉这个问题是什么吗?我在相同的托管计划上有另一个 wordpress 网站,它从来没有遇到过这个问题。站点名称是 oldbookdepot(dot)in
<!DOCTYPE html>
<html>
<body>
<script>
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML =
this.responseText;
document.getElementById("first-header").innerHTML = "HTTP Error 403 - Forbidden";
document.getElementById("second-sub-header").innerHTML = "The Web server is configured to not list the contents of this directory or you do not have enough permissions to access the resource";
var get=document.getElementsByTagName("A");
for(i=0; i<get.length; i++){
get[i].removeAttribute("onmouseover");
get[i].removeAttribute("onmouseout");
}
}
};
xhttp.open("GET", "/errors/MultiDomainHosting.php", true);
xhttp.send();
</script>
<style>
.wrapper{
overflow-y: hidden;
padding: 0px;
margin:0px;
background: none !important;
width: 100% !important;
}
.header-container {
text-align: -webkit-center;
width: 100%;
height: 150px;
background: white;
padding-top: 20px;
padding-bottom: 20px;
font-size: larger;
}
.header-container > p,h1 {
padding:5px;
}
.header-container > p {
color: #707070;
}
.header-container > h1 {
color: #333333;
}
.content-container {
position: absolute;
background-color: #202020;
height: 635px;
width: 100%;
}
.dynamic-content {
position: relative !important;
padding: 0 10em 0 10em;
top: -50px;
}
.dynamic-content > div {
border-style: solid;
border-width: 0 10px 10px 10px;
border-color: #e1e1e1;
height: 550px;
overflow-y: hidden;
}
@media only screen and (max-width:480px) {
.dynamic-content > div {
border-style: solid;
border-width: 0 2px 2px 2px;
border-color: #e1e1e1;
overflow-y: hidden;
height: auto;
}
.dynamic-content {
padding: 0;
top: 0;
}
.content-container {
height: auto;
}
}
@media only screen and (max-width: 768px) and (min-width: 481px) {
.dynamic-content > div {
border-style: solid;
border-width: 0 5px 5px 5px;
border-color: #e1e1e1;
overflow-y: hidden;
height: auto;
}
.dynamic-content {
padding: 0 2em 0 2em;
top: 0;
}
.content-container {
height: auto;
}
}
</style>
<div class="wrapper" id="wrapper">
<div class="header-container">
<h1 id="first-header"></h1>
<p id="first-sub-header"></p>
<p id="second-sub-header"></p>
</div>
<div class="content-container">
</div>
<div class="dynamic-content" id="demo">
</div>
</div>
</body>
</html>
【问题讨论】:
-
查看/errors/MultiDomainHosting.php文件和控制台日志,可能有.js错误或连接问题
-
您应该启用 WP_DEBUG 和 WP_DEBUG_LOG。在 wp-config.php 中找到:define('WP_DEBUG', false);并将其替换为:define('WP_DEBUG', true);定义('WP_DEBUG_LOG',真);运行 wp-admin 并检查 wp-content 文件夹中的内联错误和 error.log。
-
@VitaliProtosovitski 我在服务器上找不到任何 /errors/MultiDomainHosting.php 文件。
-
@PrashantSuthar 我按照你的要求做了,但在 wp-admin 或错误日志文件中都没有显示任何错误。
-
您在此文件上使用 ajax 调用 - xhttp.open("GET", "/errors/MultiDomainHosting.php", true)。此页面所需的内容是什么?你有一个空的html,没有ajax文件,你想看什么?
标签: php css wordpress http-status-code-403