Arul Ranjith
Arul Ranjith

Reputation: 495

Codeigniter URL rewrite not working with object not found error

I am new to codeigniter. I tried to use the url rewrite in my local server to hide index.php folder but it show object not found error when i try to access any controllers. or example users/login is not working whereas index.php/users/login is working how to fix it.

The details are application directory -> f:xampp/htdocs/testapp/application/controllers/users

in config.php -> $config['index_page'] = 'index.php';

in routes -> $route['default_controller'] = "users";

.htaccess rule -

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
Deny from all

working url -

localhost/bluechip/index.php/users/login

Not working -

localhost/bluechip/users/login

Upvotes: 1

Views: 1075

Answers (1)

Ariful Islam
Ariful Islam

Reputation: 7675

In config use

$config['index_page'] = '';

And use the following .htaccess -

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

Upvotes: 2

Related Questions