Search code examples
codeignitercodeigniter-2

CodeIgniter working fine on localhost, but routes doesn't work on web server


In my web server it's not on root directory, it's in a subfolder called intranet.
So I've updated database settings and this configuration in config.php:

$config['base_url'] = 'http://example.com/intranet/';

But there isn't a single route that is working, and it's working fine on localhost.
Is there any other thing that I must do to it work fine on my web server?


Solution

  • just put this code in you .htaccess file and try it

    RewriteEngine On
    RewriteBase /intranet/
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteCond $1 !^(index\.php|images|js|uploads|css|robots\.txt)
    RewriteRule ^(.*)$ /index.php/$1 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]