当我尝试为我的网站设置导航时,我不断收到此错误:
未找到
在此服务器上未找到请求的 URL /services。
此外,在尝试使用 ErrorDocument 处理请求时遇到 404 Not Found 错误。
我想要的是让内容 div是动态的。因此,当用户单击“关于我们”时,该 div 将显示“关于我们”等。页面的其余部分现在将是静态的。但是,每当我单击任何导航时,都会出现上述错误。当我检查 URL 时,它只显示:http://www.fts.us/about_us
到目前为止,这是我所拥有的:
<?php #main index
set_include_path('var/chroot/home/content/22/10350022/html'); // path to root on ftp
include($_SERVER['DOCUMENT_ROOT']."/config/setup.php"); //include setup file
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8">
<title>Untitled Document</title>
</head>
<link rel="stylesheet" type="text/css" href="/css/styles.css">
<body>
<div class ="header tempBloc">
<?php include($_SERVER['DOCUMENT_ROOT']."/templates/header.php");?>
</div>
<div class ="navs tempBloc">
<?php include($_SERVER['DOCUMENT_ROOT']."/templates/navs.php");?>
</div>
<div class ="main_content tempBloc">
<?php
$page = basename($_SERVER['QUERY_STRING']);
if(!$page){
include('/content/home.php');
} else {
if(file_exists('/content/'.$page.'.php')){
include('/content/'.$page.'.php');
} else {
echo('This page does not exist!');
}
}
#var_dump($_SERVER)
?>
</div>
<div class ="footer tempBloc">
<?php include($_SERVER['DOCUMENT_ROOT']."/templates/footer.php");?>
</div>
</body>
</html>
当我试图转储 _$SERVER 以查看其中的内容时,我得到了这个:
array(42) { ["TMPDIR"]=> string(29) "/home/content/22/10350022/tmp" ["PHPRC"]=> string(41) "/var/chroot/home/content/22/10350022/html" ["TEMP"]=> string(29) "/home/content/22/10350022/tmp" ["PHP_FCGI_CHILDREN"]=> string(1) "0" ["PATH"]=> string(29) "/sbin:/usr/sbin:/bin:/usr/bin" ["PWD"]=> string(12) "/web/cgi-bin" ["SHLVL"]=> string(1) "0" ["RAILS_ENV"]=> string(10) "production" ["SPI"]=> string(4) "TRUE" ["TMP"]=> string(29) "/home/content/22/10350022/tmp" ["PHP_FCGI_MAX_REQUESTS"]=> string(6) "100000" ["FCGI_ROLE"]=> string(9) "RESPONDER" ["UNIQUE_ID"]=> string(24) "US6vlq3JxKUAAAhxGA8AAADI" ["SCRIPT_URL"]=> string(10) "/index.php" ["SCRIPT_URI"]=> string(47) "http://www.fts.us/index.php" ["HTTP_HOST"]=> string(30) "www.fts.us" ["HTTP_CONNECTION"]=> string(5) "close" ["HTTP_ACCEPT"]=> string(63) "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" ["HTTP_USER_AGENT"]=> string(108) "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22" ["HTTP_ACCEPT_ENCODING"]=> string(17) "gzip,deflate,sdch" ["HTTP_ACCEPT_LANGUAGE"]=> string(14) "en-US,en;q=0.8" ["HTTP_ACCEPT_CHARSET"]=> string(30) "ISO-8859-1,utf-8;q=0.7,*;q=0.3" ["SERVER_SIGNATURE"]=> string(75) "
Apache Server at www.fts.us Port 80
" ["SERVER_SOFTWARE"]=> string(6) "Apache" ["SERVER_NAME"]=> string(30) "www.fts.us" ["SERVER_ADDR"]=> string(12) "72.167.0.128" ["SERVER_PORT"]=> string(2) "80" ["REMOTE_ADDR"]=> string(14) "76.116.108.244" ["DOCUMENT_ROOT"]=> string(41) "/var/chroot/home/content/22/10350022/html" ["SERVER_ADMIN"]=> string(26) "support@supportwebsite.com" ["SCRIPT_FILENAME"]=> string(51) "/var/chroot/home/content/22/10350022/html/index.php" ["REMOTE_PORT"]=> string(5) "51614" ["GATEWAY_INTERFACE"]=> string(7) "CGI/1.1" ["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1" ["REQUEST_METHOD"]=> string(3) "GET" ["QUERY_STRING"]=> string(0) "" ["REQUEST_URI"]=> string(10) "/index.php" ["SCRIPT_NAME"]=> string(10) "/index.php" ["PHP_SELF"]=> string(10) "/index.php" ["REQUEST_TIME"]=> int(1362014102) ["argv"]=> array(0) { } ["argc"]=> int(0) }
URL/URI 似乎不正确,它应该显示:http://www.fts.us/index.php?page=about_us.php
。但它不是。
哦,这是我的导航……如果有帮助的话。
include($_SERVER['DOCUMENT_ROOT']."/config/setup.php");
?>
<a href="home">home</a>
<a href="services">services</a>
<a href="about_us">about_us</a>
<a href="3_things">3_things</a>
<a href="free_stuff">free_stuff</a>
感谢任何帮助将不胜感激。