I have a Rails app on Heroku and a separate WordPress blog hosted on GoDaddy. How can I route RailsApp.com/blog to the WordPress, while maintaining it as a subdirectory of the app?
Leave a Reply
You must be logged in to post a comment.
I have a Rails app on Heroku and a separate WordPress blog hosted on GoDaddy. How can I route RailsApp.com/blog to the WordPress, while maintaining it as a subdirectory of the app?
You must be logged in to post a comment.
For Rails3.1+ (+Rails4), you should follow these:
First, Add gem rack-proxy to Gemfile
gem “rack-proxy”
Then add file proxy.rb into Rails.root/lib like this:
Register proxy to middleware into config/application.rb:
Add this line into php file wp-config.php:
Rails configuration
Add to Gemfile:
Now we want /blog and /blog/ to be directed to the WordPress instance from the Rails app.
Add this to your config.ru right before you run the app:
In config/routes.rb add a route: