![]() |
Creating Search Engine Friendly URLs - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Creating Search Engine Friendly URLs (/showthread.php?tid=21779) Pages:
1
2
|
Creating Search Engine Friendly URLs - El Forum - 08-20-2009 [eluser]ajushi[/eluser] Hi, I'm a newbie with CodeIgniter and I'm wondering, what's the suggested way of creating SEF URLs? Thanks in advance! Creating Search Engine Friendly URLs - El Forum - 08-20-2009 [eluser]Johan André[/eluser] the url_title() in the url-helper is the way to go (most times). Creating Search Engine Friendly URLs - El Forum - 08-20-2009 [eluser]ajushi[/eluser] If the format is http://localhost/controller/function/parameters how do I got about coding the title of let's say the entry for a CI blog? Creating Search Engine Friendly URLs - El Forum - 08-20-2009 [eluser]Johan André[/eluser] Code: $slug = url_title('The title of the post'); // Becomes the-title-of-the-post Creating Search Engine Friendly URLs - El Forum - 08-20-2009 [eluser]ajushi[/eluser] I mean, do I make the entry title as a parameter? Johan, what do I do with $slug as you suggested? Creating Search Engine Friendly URLs - El Forum - 08-20-2009 [eluser]Johan André[/eluser] This is really the basics (which is covered in the user guide). I suggest you watch the blog-tutorial too. Basically you do this: Save the title and slug to database. Look up the slug instead of id when displaying posts. I'm not going to write out the code for you. You need to put that together yourself. Once you get the basics of application-flow and MVC there will be no problem. Creating Search Engine Friendly URLs - El Forum - 08-20-2009 [eluser]Mikle[/eluser] [quote author="Johan André" date="1250796912"] Basically you do this: Save the title and slug to database. Look up the slug instead of id when displaying posts. [/quote] And how about perfomance if there are 2000+ posts in blog? Creating Search Engine Friendly URLs - El Forum - 08-20-2009 [eluser]Johan André[/eluser] [quote author="Mikle" date="1250797308"][quote author="Johan André" date="1250796912"] Basically you do this: Save the title and slug to database. Look up the slug instead of id when displaying posts. [/quote] And how about perfomance if there are 2000+ posts in blog?[/quote] Well, creating an index? And I don't think looking up the slug (instead of id) is gonna have a huge impact of performance... Afaik, there is no other way to do it... Creating Search Engine Friendly URLs - El Forum - 08-20-2009 [eluser]Mikle[/eluser] [quote author="Johan André" date="1250797458"][quote author="Mikle" date="1250797308"][quote author="Johan André" date="1250796912"] Basically you do this: Save the title and slug to database. Look up the slug instead of id when displaying posts. [/quote] And how about perfomance if there are 2000+ posts in blog?[/quote] Well, creating an index? And I don't think looking up the slug (instead of id) is gonna have a huge impact of performance... Afaik, there is no other way to do it...[/quote] Index of varchar(255)? Hmm... And how about md5($slug)? Creating Search Engine Friendly URLs - El Forum - 08-20-2009 [eluser]Dam1an[/eluser] [quote author="Mikle" date="1250797308"]And how about perfomance if there are 2000+ posts in blog?[/quote] It's not going to be a problem, even without an index I'm doing lookups by slug on a table with 70,000+ rows and there's no added delay compared to ID lookups |