Redirects in RoR: Which one to use?

Posted by scrr on Stack Overflow See other posts from Stack Overflow or by scrr
Published on 2010-04-29T10:17:38Z Indexed on 2010/04/29 10:57 UTC
Read the original article Hit count: 306

Hello,

we are making a website that takes a generated incoming link and forwards the user who is clicking on it to another website while saving a record of the action in our DB. I guess it's basically what ad-services like AdSense do.

However, what is the best way to redirect the user?

I think html-meta-tag-redirects are out of question.

So what other options are there?

head :moved_permanently, :location => "http://www.domain.com/"

This one is a 301-redirect. The next one is a 302:

redirect_to "http://www.domain.com"

Are there any others? And which is best to use for our case? The links are highly-dynamic and change all the time.

We want to make sure we don't violate any existing standards and of course we don't want search-engines to tag us as spammers (which we are not, btw).

Thanks!

© Stack Overflow or respective owner

Related posts about ruby

Related posts about ruby-on-rails