开发者

Codeigniter URI Segment Not Working properly online

开发者 https://www.devze.com 2023-02-16 10:31 出处:网络
Please have a look at the following url:- English: http://www.santinepal.com/demo/en Nepali: http://www.santinepal.com/demo/np

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)/(.+)$'] = "$开发者_JAVA技巧2";

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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消