I want to access my URL\'s without index.php in CodeIgniter. Here is my Blog controller
class Blog extends CI_Controller {
pub
Create new ".htaccess" file in root directory (not in CodeIgniter's application folder, where there's another htacces file, don't touch that one), with this inside:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Then, find and change this values on config.php (CodeIgniter file, on config folder):
$config['base_url'] = 'localhost/YourProject';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
Finally, on httpd.conf (Apache config file), find:
#LoadModule rewrite_module modules/mod_rewrite.so
and uncomment the line (remove #).
That's it! Now
localhost/myProject/news
works as if I write
localhost/myProject/index.php/news