Linking Rails App and Wordpress Blog on different hosts Linking Rails App and Wordpress Blog on different hosts wordpress wordpress

Linking Rails App and Wordpress Blog on different hosts


Assuming that your Rails site runs with an Apache in front, here is something you can put into the VirtualHost part of your Rails site:

<Location /blog>  ProxyPass http://godaddy.com/yourwordpress-site/</Location>

In Nginx it would look like this

location /blog {  proxy_pass http://godaddy.com/yourwordpress-site;}

Of course I would recommend, that you add some more options to the proxy setup so that the IP address of the original requester is kept etc. Doing it this way, the Webserver already catches the request and doesn't even bother your Rails app with requests that it doesn't really know about.


to redirect correctly, but not hide the url of the wordpress site

in your rails app's routes.rb

match "/blog" => redirect("http://YOUR_WORDPRESS_BLOG_SITE_URL")

Make sure you didn't forget to add http/https in your redirection url


Another alternative is to use a subdomain (instead of a subfolder), like blog.mysite.com, and then it can be handled using plain and simple dns.