Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a client who wants to migrate his Rails app to Heroku. However the client also has a blog associated with his domain that runs on WordPress. Currently, the WordPress blog is running happily alongside the Rails app, but once we migrate to Heroku, that clearly won't be possible.

The url for the app is like http://mydomain.com, and the url for the blog is like http://mydomain/blog.

I realize that the best long-term solution is to redo the blog in a Rails format like Toto or Jekyll. But in the short term, what is the best way to continue hosting the WP blog where it is (or somewhere) but use Heroku to run the app? The client doesn't want the blog to be on a subdomain, but to remain at mydomain/blog for SEO reasons and also since there is traffic to the blog. I have two ideas:

Use rack_rewrite or refraction (or just a regular old 301 and Apache mod_rewrite) on the old (non-Heroku) server to redirect the main url from the old site to Heroku. In this case, I can just leave the Wordpress blog running happily where it is. I think?? Is there a reason to choose one of those options (rack_rewrite, refraction, or mod_rewrite) over the others if I do it this way?

Switch the DNS info to point to the Heroku site, and then use a 301 redirect from the blog to the old site. But then I'll have to get the old (non-Heroku) site on a subdomain and use some kind of rewrite rules anyway so it looks like it isn't a subdomain.

Are either of these approaches preferable, or is there another way to do it that's easier that I'm missing?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Knowing that this is a stop-gap, I would give consideration to doing something like an Apache reverse proxy-pass back to Heroku. The app on Heroku should have a name like 'yourapp.heroku.com', and you can send traffic over to that without issue.

Take a look at this documentation for pointers.

share|improve this answer
    
Thanks for the info, that seems like a good solution! –  John Glass Feb 27 '11 at 21:10

Personally I would setup a 301 rewrite for /blog and send it to a subdomain like blog.domain.com. Gives a lot more flexibility to decided what server you run your blog on, say down the road the client wants to use tumblr or Wordpress.com. Also since its a 301 redirect any existing link will still work and SEO should not be effected.

If they really want it to be a subfolder uou can do a what Michael recommend if your current host/setup supports mod_proxy which would work. Or you can setup a rewrite rule like this (A client for our hosting service is using something similar)

RewriteEngine on
RewriteBase /
RewriteRule ^blog(.*) - [L] 
RewriteRule ^(.*)$ http://yourapp.heroku.com/$1 [NC,R=302]
share|improve this answer
    
And thanks to you too, also good advice! –  John Glass Feb 27 '11 at 21:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.