Noor Fathima
Noor Fathima

Reputation: 45

.htaccess is not working in codeigniter

I have started working with codeigniter and wanted to remove index.php in the URL /testing_palace/index.php/home to /testing_palace/home, working in localhost.

I google'ed the problem and tried the solutions suggested but didn't worked for me.

I changed base_url and index page in config to

$config['base_url']= 'http://localhost/testing_palace/';
$config['index_page'] ="";

And checked mod_rewrite on windows apache is enabled.

Here is my .htaccess code

RewriteEngine On
RewriteBase /testing_palace

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

All these solutions is not working for me getting not found Error.

not found error in codeigniter

Upvotes: 1

Views: 104

Answers (2)

anubhava
anubhava

Reputation: 784898

Have your /testing_palace/.htaccess like this:

RewriteEngine on

RewriteBase /testing_palace/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

then in /testing_palace/application/config/config.php you need to have these config settings:

$config['base_url']  = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';

Upvotes: 1

Ariful Islam
Ariful Islam

Reputation: 7675

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]

I think it will help you.

Upvotes: 1

Related Questions