Welcome Guest, Not a member yet? Register   Sign In
[SOLVED!] Friendly URL and removing controller name?
#5

[eluser]fancms[/eluser]
Quote:you have to be careful that you never have a page “category” that overlaps with any of your controller names.
That would be easy to do with a simple callback check when they are adding page categories

Quote:Can I ask why you want to remove the controller name anyway? Users don’t really care about URLs - most don’t even look at them.
I'm targeting a specific niche with the program I'm writing and from all the research I did and from asking the webmasters what they liked, this is what they'd want to have for their content urls. The other controllers are fine as-is (ie, news/view/3/blah and links/view/3/blah).
Quote:
Code:
$route[':any/:num/:any'] = "page/view/$2";

That route would translate the url (domain.com/site-news/36/site-launches-successfully.html) to the Page->view($id) method.

I would probably rewrite it to use RegEx, but I always have to go look that stuff up.

Thanks, Michael! Using your example and a bit of experimenting I came up with this:

Code:
$route['([a-z0-9-_]+)/([0-9]+)/([a-z0-9-_]+)'] = 'page/view/$2';

This allows alphanumeric characters with dashes (-) and underscores (_). The other controllers still work as they should. Thanks again! :lol:


Messages In This Thread
[SOLVED!] Friendly URL and removing controller name? - by El Forum - 01-21-2008, 11:00 PM
[SOLVED!] Friendly URL and removing controller name? - by El Forum - 01-22-2008, 12:20 AM
[SOLVED!] Friendly URL and removing controller name? - by El Forum - 01-22-2008, 10:20 AM
[SOLVED!] Friendly URL and removing controller name? - by El Forum - 01-22-2008, 10:59 AM
[SOLVED!] Friendly URL and removing controller name? - by El Forum - 01-22-2008, 11:52 AM
[SOLVED!] Friendly URL and removing controller name? - by El Forum - 01-22-2008, 12:02 PM
[SOLVED!] Friendly URL and removing controller name? - by El Forum - 01-22-2008, 05:28 PM
[SOLVED!] Friendly URL and removing controller name? - by El Forum - 01-28-2008, 06:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB