Wheels Blog
Archives By Subject
Recent Comments
- How OO Almost Destroyed a Business
Ali Syed said: hello, thanks for the article! i really enjoyed it! cheers - Wheels 0.9: The Final Final Beta Cycle
air max said: http://www.saleairmax.com... nike air max http://www.saleairmax.com... air max http://www.saleairmax.com...... - Learning Wheels Litepost Contest winners are
Russ Johnson said: Great Job! and congrats to the winners! - Learning Wheels Litepost Contest winners are
Mike Henke said: I was really impressed with the entries :-) Quality work and the code is on github for people to lo... - Learning Wheels Litepost Contest winners are
Raul Riera said: Congratulations to the winners :D I like the use of jQuery over the Scaffold output
Recent Entries
Creating Custom URLs in Your Wheels App with Routes
October 18, 2008 by Chris Peters
Today, I released a chapter in the Documentation called Using Routes.
Routes are a pretty cool feature of Wheels because they let you step outside of the URL convention that can sometimes feel like shackles.
As I outline in the new chapter, you can create a URL like this:
http://www.domain.com /user/johndoe
With this line of code in your config/routes.cfm file:
<cfset addRoute(name="userProfile", pattern="user/[username]", controller="user", action="profile")>
Read on to find out how it all works.


Comments
[Add Comment]
# Posted By Raul Riera | 10/18/08 8:13 PM
http://www.domain.com/news/1/story/5
instead of
http://www.domain.com/news/story/5
I think there should be an ID for the news right?
# Posted By Raul Riera | 10/18/08 8:14 PM
No, the format I have is correct.
Match this...
http://www.domain.com/news/story/5
To this...
http://www.domain.com/controller/action/id
And you get this...
controller = news
action = story
id = 5
That is the default route for Wheels.
# Posted By Chris Peters | 10/18/08 8:37 PM
# Posted By Chris Peters | 10/18/08 8:39 PM
# Posted By Raul Riera | 10/18/08 9:10 PM
[Add Comment]