views:

47

answers:

2

Hi all,

users can sign up to my site and get a standard url (username.teamgeisthq.com) from where they can access their content. They can also get a cleaner domain name like www.username.nl (same as username.teamgeisthq.com) to access their information.

Google tells me that it s bad to have 2 urls pointing to the same content. i still want the user to be able to use both domainnames but tell search engine that the main site is the www.username.nl.

I know of the 3xx redirect codes and have been reading http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10 but I don't see what code I best use (I think 302).

Can Rails output a redirect code?

Thanks

+1  A: 

You can issue redirects with a given status code via redirect_to. Your particular usage suggests "301 Moved Permanently" to me:

redirect_to 'http://www.username.nl', :status=>301

http://api.rubyonrails.org/classes/ActionController/Base.html#M000662

meagar
+1  A: 

How about a 301?

head :moved_permanently, :location => my_url
marcgg