CodeIgniter Forums
Url Routing (Wildcard) Problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Url Routing (Wildcard) Problem (/thread-53009.html)



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

[eluser]egguzel[/eluser]
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

[eluser]Carmichael[/eluser]
Does http://sitename/index.php/journals work?


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

[eluser]CroNiX[/eluser]
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

[eluser]egguzel[/eluser]
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

[eluser]InsiteFX[/eluser]
Segment 1 is the controller.

controller/method

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