Christian Fazzini
Christian Fazzini

Reputation: 19713

How do I pass the 301 to this route definition?

In routes.rb. How do I pass the :301 / :moved_permanently to the following route definition?

match '/(*path)', :to => redirect { |params, request| Addressable::URI.escape request.url.sub(request.host, "www.#{request.host}") }

Upvotes: 0

Views: 38

Answers (1)

jdoe
jdoe

Reputation: 15771

redirect accepts options. One of them is :status:

redirect(:status => 301) { |params, request| ... }

Upvotes: 1

Related Questions