apache - Codeigniter - removing index.php causes links to break -


i experiencing issue index.php in url whereby when removed links controller no longer working ?

i have modified following:

config.php:

$config['index_page'] = ''; 

uri protocol was:

$config['uri_protocol'] = 'request_uri'; 

.htaccess:

rewriteengine on rewritebase /ampp/ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php/$1 [l] 

i have verified phpinfo(); module mod_rewrite loaded.

current url in format: http://localhost:100/ampp/

the login form on main page:

<form class="form-signin" method="post" action="<?php echo site_url('auth/login') ?>">     <span id="reauth-email" class="reauth-email"></span>      <input type="email" id="inputemail" class="form-control" placeholder="email" name="email" required autofocus>     <input type="password" id="inputpassword" class="form-control" placeholder="password" name="password" required>     <br>     <button type="submit" name="submit" value="submit" class="btn btn-lg btn-primary btn-block btn-signin">sign in</button> </form> 

however when submit form getting 404

not found  requested url /ampp/auth/login not found on server. 

i have checked log files see problem log files indicate auth not found.

file not exist: /var/www/html/ampp/auth, referer: http://localhost:100/ampp/ 

technically file not located in directory log files claiming (which true file in /ampp/application/controller/) have thought codeigniter resolve appropriately.

tree structure

   . ├── cache │   └── index.html ├── config │   ├── autoload.php │   ├── config.php │   ├── constants.php │   ├── database.php │   ├── doctypes.php │   ├── foreign_chars.php │   ├── hooks.php │   ├── index.html │   ├── memcached.php │   ├── migration.php │   ├── mimes.php │   ├── profiler.php │   ├── routes.php │   ├── smileys.php │   └── user_agents.php ├── controllers │   ├── auth.php │   ├── home.php │   ├── index.html │   ├── login.php │   └── main.php ├── core │   └── index.html ├── helpers │   └── index.html ├── hooks │   └── index.html ├── index.html ├── language │   ├── english │   │   └── index.html │   └── index.html ├── libraries │   └── index.html ├── logs │   └── index.html ├── models │   ├── index.html │   ├── userauth.php │   └── user.php ├── third_party │   └── index.html └── views     ├── errors     │   ├── cli     │   │   ├── error_404.php     │   │   ├── error_db.php     │   │   ├── error_exception.php     │   │   ├── error_general.php     │   │   ├── error_php.php     │   │   └── index.html     │   ├── html     │   │   ├── error_404.php     │   │   ├── error_db.php     │   │   ├── error_exception.php     │   │   ├── error_general.php     │   │   ├── error_php.php     │   │   └── index.html     │   └── index.html     ├── home.php     ├── index.html     ├── login.php     └── report.php 

auth.php controller

<?php defined('basepath') or exit('no direct script access allowed');  class auth extends ci_controller {          public function __construct() {                 parent::__construct();                 $this->load->model('userauth');                  $this->output->set_header('last-modified:'.gmdate('d, d m y h:i:s').'gmt');                 $this->output->set_header('cache-control: no-store, no-cache, must-revalidate');                 $this->output->set_header('cache-control: post-check=0, pre-check=0',false);                 $this->output->set_header('pragma: no-cache');         }         public function index() {                 $session = $this->session->userdata('authuser');                 if(!$session) {                         redirect('login','refresh');                 } else {                         $this->propagate($session['id']);                 }         }         public function login() {                 $this->verifylogin();         }         public function verifylogin() {                 $email = $this->input->post('email');                 $password = $this->input->post('password');                  $data = array('email'=>$email, 'password'=>$password);                 $validation = $this->userauth->validateuser($data);                  if($validation == false) {                         //show login erro message - no error message implemented                         $this->load->view('login');                 } else {                         $result = $validation;                         $sess_array = array();                         foreach($result $row) {                                 $sess_array = array(                                         'authid' => sha1($result[0]->id),                                         'id' => $result[0]->id,                                         'email' => $result[0]->email                                         );                                 $this->session->set_userdata('authuser', $sess_array);                         }                         redirect('home','refresh');                 }         }         public function logout() {                 $this->session->unset_userdata('authuser');                 $this->session->sess_destroy();                 redirect('main', 'refresh');         } } 

.htaccess check

i thought give go , seems problem actual .htaccess file. why?

well have replaced content of .htaccess file this:

order deny,allow deny 

yet still able view main login page (despite fact .htaccess should not allow me)

update: ok since have noticed .htaccess file not working went digging find out why not working.

and result issue vhost configuration...

<directory "/"> //<-------- issue.     allowoverride     order allow,deny     allow </directory>   <directory "/var/www/html/ampp"> //<------- has resolved issue.     allowoverride     order allow,deny     allow </directory> 

i assuming auth controller class , login method of class. check filename of class file i.e. check filename of auth controller, should first character uppercase, "auth.php". , change action of form to

site_url('auth/login') 

note: auth lowercase in url.

hope solve problem.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -