• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Url Routing (Wildcard) Problem

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

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

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.

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

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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.