CodeIgniter Forums
Url Routing (Wildcard) Problem - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Url Routing (Wildcard) Problem (/thread-53009.html)

Url Routing (Wildcard) Problem - El Forum - 07-06-2012

Hi everybody

I have a very basic problem. Even the simplest url routing function does not work in my code.

For example when my url is http://sitename/journals, I could not go to the http://sitename/blogs page.

Can someone help me?

Thank you

routes.php file =>
$route['default_controller'] = 'index';
$route['404_override'] = '';
$route['journals'] = 'blogs';

.htaccess file =>
Deny from all

Url Routing (Wildcard) Problem - El Forum - 07-06-2012

Does http://sitename/index.php/journals work?

Url Routing (Wildcard) Problem - El Forum - 07-06-2012

Yes, if you have a "blogs" controller and using a route of "journals" to be able to access it, you will still be able to access it via "blogs". Routes just provide an additional alternative method of routing requests, but don't replace the original.

However, it doesn't matter as long as your links are consistent and always use "journals" and never "blogs". No one will know and either will search engines, which rely on links to find content.

If it's a problem for you for some reason, you can always do a check of what segment(1) is from within your "blogs" controller and if it's "blogs" instead of "journals", issue a 404 or something. Although that is really unnecessary.

Url Routing (Wildcard) Problem - El Forum - 07-07-2012

Thanks Carmichael and CroNix.

http://sitename/index.php/journals page does not work. I get 404 Not Found error.

http://sitename/index.php/blogs page works, it is OK.

I'm stuck here.

How can I check of what segment(1).

Thanks again

Url Routing (Wildcard) Problem - El Forum - 07-07-2012

Segment 1 is the controller.


So what your url's are showing is a journals and blogs controller which will always go to there index method