Khash
Khash

Reputation: 2570

Redirecting subdomain to folder in Rails 3

I need to redirect help.mydomain.com/a-page to /pages/a-page without using Nginx or Apache redirects and only through Rails 3 routes.

The key here is the help subdomain determining that /pages/ should be dropped from the route although the view is under the /views/pages/

Any help is appreciated.

Upvotes: 1

Views: 591

Answers (1)

twmills
twmills

Reputation: 3015

Try this:

match "/:page_name" => redirect("/pages/%{page_name}"), :constraints => { :subdomain => /help/ }

Upvotes: 3

Related Questions