jaypee
jaypee

Reputation: 11

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 where 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.

Upvotes: 1

Views: 1163

Answers (4)

mandoy
mandoy

Reputation: 1

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

Upvotes: 0

Dolph
Dolph

Reputation: 50650

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";

Upvotes: 2

WeeJames
WeeJames

Reputation: 540

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.

Upvotes: 1

Josh K
Josh K

Reputation: 28883

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.

Upvotes: 0

Related Questions