The last one I follow is here How to remove index.php from codeigniter in UBUNTU [duplicate]
I have one controller that look like this:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Login extends CI_Controller {
public function index()
{
$this->load->view('login.html');
}
}
When I access it by this URL: http://localhost/homerent/Login
, I got 404 not found.
I follow from answer above in referent link by
- $config['index_page'] = '';
- restart apache2 service: sudo /etc/init.d/apache2 reload
Add below code to
/var/www/html/my_ci_site/.htaccess
RewriteEngine on RewriteBase / RewriteCond $1 !^(index\.php|static|robots\.txt|favicon\.ico|uploads|googlexxxxxxxx\.html|mobile.html) RewriteRule ^(.*)$ index.php/$1 [L]
Replace every instance of
AllowOverride None
toAllowOverride All
in /etc/apache2/apache2.conf- Enable rewrite mode:
sudo a2enmod rewrite
- Finally restart apache2 service again.
After all, I access my url again http://localhost/homerent/Login
I still get 404 not found.
I have no clue what is wrong with that.