netwire
netwire

Reputation: 7215

Rails routing to subdomain

We have a site at www.example.com but needs to move it to subdomain1.example.com, while maintaining the SEO links. We are planning to use Google's Change of Address but it requires 301 redirects.

We plan to release another site at the www.example.com address.

Is there a way to changes the routes.rb of www.example.com so that certain routes gets redirected to subdomain1 and others don't?

Upvotes: 0

Views: 95

Answers (1)

Jessiah
Jessiah

Reputation: 1644

I am not sure exactly what you mean by redirect but here are some options: You can redirect a route to another route in your rails app using:

get '/some_route', to: redirect('/other_route')

Or if the subdomain is a seperate app / service you can redirect in a controller using:

redirect_to "http://www.rubyonrails.org"

Upvotes: 1

Related Questions