Freelance Mobile & Web Developer

A Ruby & Javascript hacker.

Routing a Wordpress Blog Inside a Rails App

This post describe how to host a subdomain route for a alien application inside a Ruby on Rails app. Wordpress is used here as an example but these instructions work with any outside url.

If you do have control over the web server you can use a url rewrite to accomplish this. See steps for doing this using Apache or nginx.

However what about when you have no control over the web server layer (such as when hosting the Rails application on Heroku)? The answer is to use the Rails routing engine do the routing.

 match "/blog" => redirect(""), :as => :blog

This will match any ‘/blog’ route and redirect to your chosen domain.