AnthonyGalli.com AnthonyGalli.com - 4 months ago 7
Ruby Question

How to remove /posts/ from URL?

How can I also show a blog post without

/posts/
in the URL?

http://www.anthonygalli.com/posts/i-walk-the-line
http://www.anthonygalli.com/posts/50-shades-of-galli
http://www.anthonygalli.com/posts/tips-for-regaining-momentum


Shortened Version (Goal of Question):

http://www.anthonygalli.com/i-walk-the-line
http://www.anthonygalli.com/50-shades-of-galli
http://www.anthonygalli.com/tips-for-regaining-momentum


I have
post
as a MVC.

routes.rb

resources :posts

Answer

Change your routes.rb to:

resources :posts, path: '/'
Comments