URL Adjustments

I was just wondering how I would go about changing my url structure from underscores to dashes. Also how I can remove the controller name from the url? eg: http://example.com/pages/about_us to http://example.com/about-us Thanks for your help. Brian

Posted over 3 years ago by Brian Gilbank
Posted over 3 years ago by Alex Yang

To learn how to customize your URLs, I'd highly recommend reading the Rails Guide below. While it's very comprehensive (and can get dense at times), it's worth at least a quick skim.
http://guides.rubyonrails.org/routing.html#customizing-resourceful-routes

The easiest way to customize the URL for a specific action is to use this code in your routes.rb file:
get '/about-us', to: 'pages#about_us'

Hope that helps!

1
Posted over 3 years ago by Brian Gilbank

Great, thanks!

1