我正在尝试添加指向我网站的不同页面的链接,但是当我点击该链接时,它会给我一个" 404 Page Not Found"错误。
目标:所有我想要的就是能够将我的主页index.php链接到我网站的其他页面,例如contact.php,about.php。
我要链接到的页面的代码位于我的文件管理器的" public_html文件夹中。此代码实际上是about.php页面的副本。我以为我只会更改文件名,上传文件管理器然后更改代码:
<?php $this->load->view('header'); ?>
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
About Us
</h1>
</div>
</div>
<!-- Intro Content -->
<div class="row">
<div class="col-md-8">
<strong><u>Mission Statement</u></strong><br />
</P>
<?php $this->load->view('footer'); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Angel Application is a free online database/website designed for students, who can exchange,sell, or donate textbooks.">
<meta name="author" content="">
<meta name="google-site-verification" content="ZC66iDvmwxnyIuvY7aPWACB0PVQzAgh7ykwIlDSfDXc" />
<title>Angel Application</title>
<!-- Bootstrap Core CSS -->
<link href="<?php echo base_url();?>css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="<?php echo base_url();?>css/modern-business.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="<?php echo base_url();?>font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="<?php echo base_url();?>js/jquery.js"></script>
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<a href="index.php"><img src="<?php echo base_url();?>images/AngelLogo.png" alt="Angel" title="Angel Application" height="63" width="300" align="left" style="margin: 2px 8px 2px -15px;"/> </a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
<?php if($this->session->userdata('public_logged_in')==TRUE){?>
<a href="<?php echo base_url();?>index.php/login/logout">Hi <?php echo $this->session->userdata('public_username');?> | Logout</a>
<a href="<?php echo base_url();?>index.php/login/myhome">My Account</a>
<?php }else{?>
<a href="<?php echo base_url();?>index.php/login">Login</a>
<?php }?>
</li>
<li>
<a href="<?php echo base_url();?>index.php/about">About</a>
</li>
<li>
<a href="<?php echo base_url();?>index.php/contact">Contact Us</a>
</li>
<li>
<a href="<?php echo base_url();?>sample2">Upload</a>
</li>
</ul>
</div>
<div>
<li>
</li>
</div>
<!---
div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
<?php if($this->session->userdata('public_logged_in')==TRUE){?>
<a href="<?php echo base_url();?>index.php/login/logout">Hi <?php echo $this->session->userdata('public_username');?> | Logout</a>
<a href="<?php echo base_url();?>index.php/login/myhome">My Account</a>
<?php }else{?>
<a href="<?php echo base_url();?>index.php/login">Login</a>
<?php }?>
</li>
<li>
<a href="<?php echo base_url();?>index.php/about">About</a>
</li>
<li>
<a href="<?php echo base_url();?>index.php/contact">Contact Us</a>
</li>
<li>
</li>
<li>
</li>
</ul>
</div>
--->
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<!-- Header Carousel -->
<header id="myCarousel" class="carousel slide">
<!-- Indicators -->
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<div class="fill" style="background-image:url('<?php echo base_url();?>images/Andoverharvard.jpg');"></div>
<div class="carousel-caption">
<h4>A free and non-profit platform for exchanging, selling and donating books</h4>
</div>
</div>
</div>
</header>
<!-- Page Content -->
<div class="container">
<br />
<?php echo $this->session->flashdata('message'); ?>
答案 0 :(得分:1)
您的htaccess文件中不太可能出现404。它只是意味着你指向一个不存在的文件。
您的问题很可能是您如何调用远程脚本。
此行应该类似(假设您调用的文件是php文件)
<?php $this->load->view('header.php'); ?>
对于页脚来说,同样的事情也是如此。
修改强>
你的问题在于这些行:
<li>
<?php if($this->session->userdata('public_logged_in')==TRUE){?>
<a href="<?php echo base_url();?>index.php/login/logout">Hi <?php echo $this->session->userdata('public_username');?> | Logout</a>
<a href="<?php echo base_url();?>index.php/login/myhome">My Account</a>
<?php }else{?>
<a href="<?php echo base_url();?>index.php/login">Login</a>
<?php }?>
</li>
<li>
<a href="<?php echo base_url();?>index.php/about">About</a>
</li>
<li>
<a href="<?php echo base_url();?>index.php/contact">Contact Us</a>
</li>
<li>
<a href="<?php echo base_url();?>sample2">Upload</a>
</li>
您正在将index.php视为目录;它完全是不必要的,因为你已经回显了基本URL(根本不需要它,除非你从根目录以外的目录中引用它们。如果是这样,那么是的,这没关系)。将所有这些行更改为以下内容:
<a href="<?php echo base_url();?>/login/logout"
注意,您的页脚文件可能也会出现这样的问题
答案 1 :(得分:0)
是nomistic,
我想,既然你花了一些时间来处理我的问题,那么发布解决方案对我来说是公平的。在尝试了我们讨论的内容之后,我仍然无法让它发挥作用。由于我不是那个建立这个网站的人,所以我最终决定问我的网页设计师。
这是他写的:
再次感谢您的帮助!