How to SEO URL Rewriting |
[eluser]newbiewcoder[/eluser]
Hello everybody. I have an app that have URL like this: http://localhost/mysite/news/detail/123 news is my controller, detail is my function that will accept argumen (123) I want to make the URL like this: http://localhost/mysite/news/detail/this...f-the-news I want to totally masking/remove the id of the news, and replace it with the real title of the news from the database. Can I achieve this goal? Thanks
[eluser]Raphael Passini[/eluser]
Why dont you create a column in the table on the database named 'url_title', then load the news using this field. Something like that: Code: function detail($title) {
[eluser]ciGR[/eluser]
Hi and wellcome! I agree with Raphael and I suggest you to take a look at Code: url_title()
[eluser]newbiewcoder[/eluser]
Thanks both for you Raphael and ciGR. That't work for me. And url_title() just fine to, it save the time to make better URL. And BTW I need one (maybe two or more) open source app based on CI other than bambooinvoice. Learning from the sample give a better result. Don't you? Thanks alot.
[eluser]Unknown[/eluser]
url_title() works just fine. However I noticed that it doesn't properly replace dots (.) and separators ($search) into replace ($replace). If you open url_helper.php and see at url_title() function you will see Code: $trans = array( adding those 2 lines will make it work: Code: $trans = array( cheers, |
Welcome Guest, Not a member yet? Register Sign In |