I have a rails application that needs a blog. I have looked at various rails cms and blog engines and none of them meet my needs. I would like to add WordPress on a sub uri www.example.com/blog. My application is hosted on Heroku. I am able to install wordpress independently as a separate app on heroku and I have tried adding wordpress to the public folder with an .htaccess file like this:
RewriteEngine On
RewriteRule ^([^.]+[^/])$ http://%{HTTP_HOST}/$1/ [R=301,L]
RewriteBase /
RewriteCond RewriteCond %{REQUEST_URI} ^/blog.*$
RewriteCond %{DOCUMENT_ROOT}/-%2 -d
RewriteRule ^(.*)$ -%2/$1 [QSA,L]
but to no avail. I cant use reverse proxies because I would like to have SSO (and shared navigation bar etc and really dont want wordpress and my app to be “separate” applications on heroku) between the Rails app and the wordpress installation. Is there a way to achieve this
I would take a look at wordpress-heroku
As far as sub URI’s, you start to make things more complex when it’s not necessary. If you want you can run two Heroku apps, but instead of using folder paths, use a subdomain so your main app runs on http://www.example.com and your blog runs on blog.example.com. The use of subdomains is greatly respected in uses like this and makes things a lot easier.
Are you able to access the Virtual Host file for the server? If so then the adding the following in the server may be your answer:
However I guess it also depends on how the rails app is deployed and whether the public folder is updated on deployment. You may need to symlink the public folder so it is not updated each time the site is deployed.
I couldn’t say if this would work for Heroku having never used their services but hopefully it will help.
Source: http://ziyedbd.wordpress.com/2012/05/11/deploying-wordpress-blog-inside-ruby-on-rails-application/
Symlink info: http://linux.byexamples.com/archives/19/how-to-create-symlink/