开发者

codeigniter broken link

I'm new in codeigniter. i have a project running perfectly in my localhost. when i deployed, my links seem to be broken. e.g. mysite.com displays the homepage without any error. now, i have a link let's say an about us link e.g. mysite.com/main/about wher开发者_如何转开发e main is my controller and about is my function. the problem is the about us link is broken e.g. "Oops! This link appears to be broken." do you have any idea where did i go wrong? thank you for any positive response.


It looks like you have configured your application to remove /index.php/ from your URLs, but I suspect you have not included the .htaccess file to provide mod_rewrite support.

If you want to exclude /index.php/ from your URLs, make sure you follow everything in this tutorial.

Or, to get your site working ASAP, restore the default value of index_page in system/application/config/config.php to:

$config['index_page'] = "index.php";


I'd check 2 things first.

  1. Your base site url is properly configured to either the correct url or $config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'];
  2. Your .htaccess file is properly configured and you have the mod_rewrite apache module installed.


You have to make sure the links are either relative to the path or use the base_url() function provided by the URL helper. See URL Helper.


Can you try to use this code below, hopefully it will works :)
RewriteEngine On
RewriteCond $1 !^(index.php)
RewriteRule ^(.+)$ index.php?$1 [L]

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜