• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
URL rewriting

#1
[eluser]Ickes[/eluser]
Noob education ongoing....

Trying to learn about URL formation in CI. 1 question I can't seem to answer.

For example,
Have class Blog with function one_entry().
To access, user goes to this page address -> index.php/blog/one_entry/article-name.html.

How would I change that to index.php/blog/<b>one-entry</b>/article-name.html without renaming the function itself? That is, how do I replace _ with -?

Is this possible?

I have read the User Guide on Routing but don't think that is my answer.

I also checked this forum entry but that didn't help either but I may not have grasped all of it. Help for Custom URL.

#2
[eluser]Chad Fulton[/eluser]
I think Routing is your answer. Try this:

Code:
$route['blog/one-entry/:any'] = 'blog/one_entry/$1';

Why don't you think Routing is your answer? It seems like you want a pretty straightforward mapping from one URI (with one-entry in it) to another (with one_entry in it).


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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