search queries in first part of URI - 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: search queries in first part of URI (/showthread.php?tid=27027) Pages:
1
2
|
search queries in first part of URI - El Forum - 01-30-2010 [eluser]Sean Gates[/eluser] Yep. I agree: 10 ways to do anything in programming. Messing a ton with routes makes it a headache down the road. Just letting him know that prefixing it would be easier. If you were doing a blog (like wordpress), then you could set your route to look for a year in the first segment (e.g.: like 2010, 4 digits). But otherwise, /search/ is a nice prefix and is also SEO friendly allowing for semantics in the URL. search queries in first part of URI - El Forum - 01-30-2010 [eluser]Joshua Logsdon[/eluser] @Sean: Sounds good and you're 100% right about prefixing. Again, prefixing "cures all", so I'm not backtalking here, but I have to add this into how I came up with what I'm doing... I'm on a project where a client will be creating pages and they want the urls to look like example.com/my-page-name Trust me, I would have loved to say no, your urls will look like example.com/pages/my-page-name, but instead I kind of took it up as a challenge first. After I tried the catchall routing and found the issue with having to list all routes, I didn't want another place to manage or break if I decided to change a controller name, etc. So the small add-on (I did another to help process controller and method names with dashes) is what I came up with. In my catchall I can query if a page exists with that name and if not, spit out the 404. Also for the blog example earlier (I knew you were going to point out the 4 digit route ), address formats can vary like in Wordpress... example.com/2010/01/29/my-article, example.com/my-blog-name/my-article, etc. so in the catchall I analyze the segments to determine how things need to be looked up. search queries in first part of URI - El Forum - 01-31-2010 [eluser]Yednotek[/eluser] Great replies guys! I'm sure I'll be able to build a solution to the problem now. Thanks! search queries in first part of URI - El Forum - 03-04-2010 [eluser]doccer[/eluser] For those interested.. ME HMVC does a custom 404 in their MY_Router.php under the _validate_request function. So if you have a Code: $route['404'] = "site/$1"; |