301 Redirects in Rails
A 301 redirect is a permanent redirect, which tells the search engines to index the redirected to URL rather than the current URL.
You can use this when migrating from legacy content management systems, or to make sure that you only have 1 URL per page.
With the folloing code in your controller, Rails makes it easy :
1 2 |
headers["Status"] = "301 Moved Permanently" redirect_to "http://someurl/" |
2 comments
Like this article? Subscribe to the SEO on Rails feed.
Comments
-
Try this:
head :moved_permanently, :location => 'http://whatever' -
Awesome, thanks Rick!
