My route has root set to :
root :to => "posts#index", :locale => :en
But /en/posts/ and /en/posts/index is still accessible, showing “duplicate” content from the root_path. I would like to redirect to root_path, if one of those paths is used.
That way, I can avoid duplicate content in search engines and my users have a more consistent experience: a resource lives on only one place and one place only (REST).
You can turn off the posts/index url by editing the posts resource in your routes.rb file to look like this:
If this gives you issues with redirection, read the rails guides on routing, specifically section 3.12 Redirection