Dushani
Dushani

Reputation: 43

codeigniter, 404 not found error

I have a web site and I have installed CodeIgniter 2 Site under sub folder (test)

Users can access the site by using following link:

http://www.example.com/test/

When user is going to access (test) site using above link URL redirected to following link and following error will displayed.

http://www.example.com/test/login

Not Found

The requested URL /test/login was not found on this server.

Then I add index.php to the above URL, login page displayed.

http://www.example.com/test/index.php/login

When I submit my username and password again URL redirected to, without logged on.

http://www.example.com/test/login

And again, not found.

.htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

config.php:

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

I have tried $config['base_url'] = "http://www.example.com/test" - still not working.

Upvotes: 0

Views: 143

Answers (3)

Abdulla Nilam
Abdulla Nilam

Reputation: 38672

in config/config.php

$config['base_url'] = 'https://stackoverflow.com/';
$config['index_page'] = '';

in .htaccess (place outside application folder)

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule>

Upvotes: 1

mokNathal
mokNathal

Reputation: 553

try this in your .htaccess

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]

Upvotes: 0

Nithin Krishnan P
Nithin Krishnan P

Reputation: 758

replace .htaccess with this code

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

Upvotes: 0

Related Questions