将项目从localhost上传到服务器时出现404错误

时间:2015-08-13 06:40:00

标签: php codeigniter codeigniter-2

我正在尝试将codeigniter项目从本地系统上传到服务器。 我已经对config / database.php进行了必要的更改,并将我的base_url更改为指向$ config [' base_url'] =' http://hrlwebproducts.com/non-disclosure-agreement/&#39 ;;因为我想在名为non-disclosure-agreement的文件夹中运行整个项目。

现在一切都在localhost上运行正常。当我点击登录页面中的提交按钮时,它会将我带到安全页面,我的浏览器上的网址将更改为http://localhost/non-disclosure-agreement/index.php/verifylogin,它会正确显示页面,但是当我在服务器上按下登录页面的提交按钮时并尝试访问此安全页面,网址为http://hrlwebproducts.com/non-disclosure-agreement/index.php/verifylogin,我收到错误。

未找到404页面

找不到您请求的页面。

我对这个错误一无所知。

我的观看代码是:



	<div id="outer">
    <div id="inner">
    <p id="heading">NDA</p>
    <p>If not registered then click here..<a href="<?php $this->load->helper('url'); echo site_url('welcome/') ?>">register</a></p>

   <?php echo validation_errors(); ?>
   <?php echo form_open('verifylogin'); ?>
     
     <input type="text" size="20" id="username" name="username"/>
     <br/>

     <input type="password" size="20" id="password" name="password"/>
     <br/>
         <input type="checkbox" name="terms" value="terms">I have read all the <a href="<?php $this->load->helper('url'); echo site_url('welcome/linkroutes') ?>">Terms & Conditions</a><br><br>
     <input type="submit" value="Login"/>
   </form>
 
	</div>
    </div>
&#13;
&#13;
&#13;

我的控制器是VerifyLogin,代码是:

&#13;
&#13;
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class VerifyLogin extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	 
	 
 function __construct()
 {
   parent::__construct();
   $this->load->model('user','',TRUE);
       $this->load->helper('form');
        $this->load->helper('url');
 }
 
	public function index()
	{
		
		$this->load->library('form_validation');
 
   $this->form_validation->set_rules('username', 'Username', 'trim|required');
   $this->form_validation->set_rules('password', 'Password', 'trim|required|callback_check_database');
 
   if($this->form_validation->run() == FALSE)
   {
	   $this->form_validation->set_message('Password', 'text dont match captcha');
     //Field validation failed.  User redirected to login page
     $this->load->view('login');
   }
   else
   {
     //Go to private area
  $this->load->view('dashboard');
   }
	}
	
	
	 function check_database($password)
 {
   //Field validation succeeded.  Validate against database
   $username = $this->input->post('username');
 
   //query the database
   $result = $this->user->login($username, $password);
   $this->load->library('session');
 
   if($result)
   {
     $sess_array = array();
     foreach($result as $row)
     {
       $sess_array = array(
         'id' => $row->id,
         'username' => $row->username
       );
       $this->session->set_userdata('logged_in', $sess_array);
     }
     return TRUE;
   }
   else
   {
     $this->form_validation->set_message('check_database', 'Invalid username or password');
     return false;
   }
 }    
	
		public function linkroutes()
	{
		$this->load->view('dashboard');
	}
	
		public function linkroutestoform()
	{
		
				$this->load->view('formfill');
				

	}
}
&#13;
&#13;
&#13;

我的.htaccess文件是

&#13;
&#13;
<IfModule authz_core_module>
    Require all denied
</IfModule>
<IfModule !authz_core_module>
    Deny from all
</IfModule>
&#13;
&#13;
&#13;

0 个答案:

没有答案