sodhancha
sodhancha

Reputation: 435

Codeigniter URI Segment Not Working properly online

Please have a look at the following url:-

English: http://www.santinepal.com/demo/en

Nepali: http://www.santinepal.com/demo/np

The codeigniter profiler is ON but it shows

URI STRING
No URI data exists

The $this->uri->segment(1); shouldve returned en or np but it reruns nothing.

This works fine on my localhost.

my routes.php file has:-

$route['default_controller'] = 'front';
$route['backend'] = 'backend/sentry';

// URI like '/en/about' -> use controller 'about'
$route['^(en|np)/(.+)$'] = "$2";

// '/en' and '/fr' URIs -> use default controller
$route['^(en|np)$'] = $route['default_controller'];

Upvotes: 0

Views: 885

Answers (2)

davzie
davzie

Reputation: 116

I've had something similar, turns out some server setup caused the issue. Try changing your .htaccess file that removes the index.php to this:

#CODE IGNITER - REMOVE INDEX.PHP
RewriteCond $1 !^(index\.php|resources|file_uploads|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]

The last line is the only one that is different, there is a ? after the index.php.

Upvotes: 0

Eddie Groves
Eddie Groves

Reputation: 34848

Check that your .htaccess file is the same on the server and that URL Rewriting is enabled.

Navigating to http://www.santinepal.com/demo/index.php/en shows the URI segments working, so it must be server configuration issue.

Upvotes: 1

Related Questions