首页 > 解决方案 > 找不到错误对象在此服务器上找不到请求的 URL

问题描述

我正在制作一个类似于 stackoverflow 网站的网站,当我尝试访问 signin.php 或注册页面时仍然出现错误说:找不到对象!在此服务器上找不到请求的 URL。引用页面上的链接似乎是错误的或过时的。请将该错误通知该页面的作者。

如果您认为这是服务器错误,请联系网站管理员。

错误 404。

请注意,我可以毫无问题地访问其他页面(index.php、questionDetails.php、...)

然后当我进行搜索以了解为什么会出现此错误时,我发现我缺少诸如 .htaccess 文件之类的东西。

所以她我的项目是什么样子的:

层次结构: 我的文件层次结构

navbar.php 文件:

<?php 
if (! isset($_SESSION)) {
    session_start();
    
}
echo $_SERVER['PHP_SELF'];
 ?>
<!DOCTYPE html>
<html>
<style type="text/css">
    .brand{
        font-family: fantasy;
    }
    .ulNavbar{
        display: inline-flex;
    }
</style>
<nav class="nav-wraper white ">
    <div class="container">
        <a href="index.php" class="brand-logo brand black-text">UnivBatna</a>

        <a href="#" class="sidenav-trigger" data-target='mobile-links'>
            <i class="material-icons blue-text">menu</i>
        </a>
       
    <ul class="right hide-on-med-and-down ulNavbar">
       <?php if (!empty($_SESSION['username'])){ ?>
            <img src="../imgs/yuna.jpg" alt="image" width='40px' height='50px' alt="" class="circle responsive-img img-profile">
             <p class="right black-text"> <?php echo $_SESSION['username']; ?></p>
                     
                     <button id="logout">LogOut</button>
                     <form action="../includes/logout.inc.php" method="POST">
                        <input type="submit" name="logout" class="btn" value="Logout">
                     </form>
                <?php } else{ ?>

             <li><a href="./auth/Signin.php" class="btn brand">sign In</a></li>
             <li><a href="./auth/Signup.php" class="btn brand">sign up</a></li>

               <?php } ?>
        
    </ul>

    </div>
    
</nav>

<ul class="sidenav" id="mobile-links">
   <li><a href="addquestion.php" class="btn blue">Add Question</a></li>
</ul>

</html>

index.php 文件



<!DOCTYPE html>
<html>
<?php include('./templates/header.php') ;?>
<?php include('./dashboard/Dashboard.php') ?>
<?php include('./templates/footer.php'); ?>


</html>

我认为我在这里遗漏了一些东西。已经谢谢了

标签: php

解决方案


推荐阅读