0

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.

6
  • did you load url helper ? in autoload.php $autoload['helper'] = array('url');
    – mokNathal
    Jul 2, 2015 at 6:15
  • remove space between / / $config['base_url'] = 'http://www.example.com/test'
    – Saty
    Jul 2, 2015 at 6:17
  • Check all controllers and models file names and class names have first letter upper case
    – user4419336
    Jul 2, 2015 at 6:19
  • this site working in localhost but online not working
    – Dushani
    Jul 2, 2015 at 6:22
  • test this $config['uri_protocol'] = 'PATH_INFO'; Or $config['uri_protocol'] = 'REQUEST_URI'; Jul 2, 2015 at 6:24

3 Answers 3

1

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>
22
0

replace .htaccess with this code

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

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]
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.