CodeIgniter Forums
URI Routing problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: URI Routing problem (/showthread.php?tid=35573)



URI Routing problem - El Forum - 11-03-2010

[eluser]onikage997[/eluser]
hi all,

Can someone please help me. I recently finished applying CodeIgniter in my site. www.the-benefits-of.com

I've tested all url in my local server and all is working fine.

But after uploading all my files in live...
Problem:
- All of my links are showing the default index of my default controller.
- No matter what almost I do, the page calls the function index in the class of my default controller.

Here's my code in routes.php
Code:
$route['default_controller'] = "benefits";
$route['scaffolding_trigger'] = "";
$route['benefits-of-.+.html'] = "benefits/title";
$route['index.html'] = "benefits/index";
$route['about-us.html'] = "page/title";
$route['list-of-benefits.html'] = "page/title";
$route['search-benefits-result.html'] = "page/title";
$route['copyright-notice.html'] = "page/title";

Here's my code in .htaccess
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|y_key_8cea22b21ebf57b1\.html|sitemap\.xml|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

Here's my code in controller benefits.php
Code:
<?php
class Benefits extends Controller {
function Benefits()
    {
        parent::Controller();
    }
    
function index()
    {
//Why do I always get called in live?
}
    
function title()
    {
//I don't get called in live but I'm looking good here in the local server.
}
}



Please Note:
- I've tested all url in my local server and all is working fine.


many thanks guys...


URI Routing problem - El Forum - 11-03-2010

[eluser]onikage997[/eluser]
bump.... please help... Sad Sad

if I'm posting this on a wrong thread please guide me where's the right place so someone can answer me...

many thanks


URI Routing problem - El Forum - 11-04-2010

[eluser]Bart Mebane[/eluser]
I tried most of the urls that are listed in your routes, and they seemed to be returning the correct pages. Are you still having problems?


URI Routing problem - El Forum - 11-04-2010

[eluser]onikage997[/eluser]
hi,

yes, I'm still having this problem. My hosting said there's a problem with their mod_rewrite thing in the server and their working on it right now but it's already been a day.

You can check my website Codeigniter Version here http://beta.the-benefits-of.com
As you'll see there.., all of my links will show you a content of my index..

Also, I have these error in my error_logs:
Code:
[03-Nov-2010 06:01:30] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20060613/' - /usr/local/lib/php/extensions/no-debug-non-zts-20060613/: cannot read file data: Is a directory in Unknown on line 0
[03-Nov-2010 06:01:32] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20060613/' - /usr/local/lib/php/extensions/no-debug-non-zts-20060613/: cannot read file data: Is a directory in Unknown on line 0
[03-Nov-2010 06:01:33] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20060613/' - /usr/local/lib/php/extensions/no-debug-non-zts-20060613/: cannot read file data: Is a directory in Unknown on line 0
[03-Nov-2010 06:01:36] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20060613/' - /usr/local/lib/php/extensions/no-debug-non-zts-20060613/: cannot read file data: Is a directory in Unknown on line 0


thanks for replying...


URI Routing problem - El Forum - 11-05-2010

[eluser]Bart Mebane[/eluser]
It's hard to tell what's going on. You can try temporarily removing or renaming your .htaccess until your host gets the problem fixed, and using index.php in the url. A couple of questions ... what is the base_url set to in your config.php? Do you have two controllers, "benefits" and "page"?


URI Routing problem - El Forum - 11-05-2010

[eluser]Bart Mebane[/eluser]
The site seems to work if you include index.php in the url (for example, http://beta.the-benefits-of.com/index.php/list-of-benefits.html). Need to change css path from relative to absolute.


URI Routing problem - El Forum - 11-05-2010

[eluser]onikage997[/eluser]
hi,

Yes I've notice that but it won't make sense if I don't take that index.php out since its for seo purpose....

I need the url to work without that index.php...


thanks for replying.


URI Routing problem - El Forum - 11-05-2010

[eluser]Bart Mebane[/eluser]
It probably won't work without index.php until your host fixes the mod rewrite problem.


URI Routing problem - El Forum - 11-11-2010

[eluser]onikage997[/eluser]
hi Bart,

Code below fixed the problem
Code:
$path = (isset($_SERVER['ORIG_PATH_INFO'])) ? $_SERVER['ORIG_PATH_INFO'] : @getenv('ORIG_PATH_INFO');
if (trim($path, '/') != '' && $path != "/".SELF)
{
$this->uri_string = $path;
return;
}


thanks


URI Routing problem - El Forum - 03-22-2012

[eluser]Reneesh T K[/eluser]
I was a problem with codeigniter url rewriting.

I have to go to www.abc.com/catalog/product/4354

when using the url www.abc.com/samsung_galaxy_y it was not working.

After a long time I find out the reason and fixed it.

I have explained it in my blog.


http://myphplibrary.blogspot.in/2012/03/codeigniter-routing-issue-fixation-url.html