找不到对象!在此服务器上找不到请求的URL.本地主机 [英] Object not found! The requested URL was not found on this server. localhost

查看:248
本文介绍了找不到对象!在此服务器上找不到请求的URL.本地主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个典型的设置A,M,P,我只是在本地服务器上进行一些测试以设置网页.我对php和动态网站有些陌生,所以我有点糊涂了.所以我在这里陷入僵局.每当我尝试在浏览器中查看页面并单击链接时,都会出现此错误:

I have a typical set up A,M,P and i am just doing some testing on my localhost server for setting up a webpage. I'm a bit new to php and dynamic sites so I'm muddling my way though. So I am at an impasse here. Whenever I attempt to view the page in the browser and click on the links I get this error:

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

Object not found! The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error. If you think this is a server error, please contact the webmaster. Error 404 localhost 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页面的代码

here is the code for my index.php page and my nav.php page

第一个index.php

first 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

Here is my 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错误使我认为这可能与本地主机有关,而与我的代码无关.

I thought this might be a permissions problem because /content/home.php is in a subfolder in xxamp/htdocs/test. But I'm not entirely sure. I could test this on a hosting site which I have but the 404 error makes me think it might be something with localhost and not with my code.

推荐答案

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

mostly this kind of error is caused by missing an .htaccess file in your root wordpress directory , however in order to check that , get in touch directly to the permalink structure and try to change your permalink and hit save , once you find the same error you should directly create an .htaccess file under wordpress root and make its first permissions to 777 , then refresh your site an click save change on your permalink , once your site continue to run correctly as you were expected , you should right away comeback to your .htaccess and change it to 644 in order to secure your site , i believe that this happened in most wordpress permalink settings , hopefully it would be helpful for anyone who meet this kind of issue .

这篇关于找不到对象!在此服务器上找不到请求的URL.本地主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆