编程语言
首页 > 编程语言> > php – 找不到对象!在此服务器上找不到请求的URL.本地主机

php – 找不到对象!在此服务器上找不到请求的URL.本地主机

作者:互联网

大家好日子.我有一个典型的设置A,M,P,我只是在我的localhost服务器上进行一些测试来设置网页.我对php和动态网站有点新意,所以我现在糊里糊涂了.所以我在这里陷入僵局.每当我尝试在浏览器中查看页面并单击链接时,我会收到此错误:

找不到对象!
在此服务器上找不到请求的URL.引用页面上的链接似乎是错误的或过时的.请通知该页面的作者有关错误的信息.
如果您认为这是服务器错误,请与网站管理员联系.
错误404
本地主机
Apache / 2.4.3(Win32)OpenSSL / 1.0.1c PHP / 5.4.7

my url looks like this: http://localhost/test/content/home

这是我的index.php页面和我的nav.php页面的代码

第一个index.php

<?php
include('Config/setup.php');
?>
<?php
if(isset($_GET['page']) && $_GET['page'] == !'') {
    $pg = $_GET['page'];
} else {
    $pg = 'home';
}
#var_dump($pg);
#exit;
?>

<!DOCTYPE HTML>
<html>
<head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">

    <title>FTS</title>
    <link href="css/Styles.css" rel="stylesheet" type="text/css">
</head>

<body>
<div class="header temp_Block">
    <?php include('templates/header.php');?>
</div>

<div class="main_nav temp_Block">
    <?php include('templates/main_nav.php');?>
</div>

<div class="main_Content temp_Block">
    <?php include('Content/'.$pg.'.php');?>
</div>

<div class="footer temp_Block">
    <?php include('templates/footer.php');?>
</div>
</body>
</html>

这是我的nav.php

<?php include('Config/setup.php')?>

 <a href="/test/content/home">home</a>
 <a href="/test/content/freestuff">free stuff</a>
 <a href="/test/content/aboutus">about us</a>
 <a href="/test/content/services">services</a>
 <a href="/test/content/Whatwedobetter">What we do better</a>

我认为这可能是权限问题,因为/content/home.php位于xxamp / htdocs / test的子文件夹中.但我不完全确定.我可以在我拥有的托管网站上测试这个,但404错误让我觉得它可能是localhost而不是我的代码.

所有帮助都表示赞赏,并提前感谢.

解决方法:

大多数这种错误是由于你的root wordpress目录中缺少一个.htaccess文件引起的,但是为了检查它,直接联系永久链接结构并尝试更改固定链接并点击保存,一旦找到相同的错误你应该直接在wordpress root下创建一个.htaccess文件并将其第一个权限授予777,然后在你的固定链接上刷新你的网站点击保存更改,一旦你的网站继续按照你的预期正确运行,你应该立即回归你的.htaccess并将其更改为644以保护您的网站,我相信这发生在大多数wordpress固定链接设置中,希望它对任何遇到此类问题的人都有帮助.

标签:php,http-status-code-404,localhost
来源: https://codeday.me/bug/20191002/1843126.html