Need to link WP Blog with Rails App on Heroku

Posted by John Glass on Server Fault See other posts from Server Fault or by John Glass
Published on 2011-02-27T01:28:35Z Indexed on 2011/02/27 7:26 UTC
Read the original article Hit count: 516

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?

© Server Fault or respective owner

Related posts about mod-rewrite

Related posts about ruby-on-rails