Startseite Impressum / Kontakt Datenschutz (Disclaimer) Haftungsausschluss
Auto & Verkehr Bildung, Karriere & Schulungen Elektro & Elektronik Essen & Trinken Familie, Kinder & Zuhause Freizeit, Buntes & Vermischtes Garten, Bauen & Wohnen Handel & Dienstleistungen Immobilien Internet & Ecommerce IT, NewMedia & Software Kunst & Kultur Logistik & Transport Maschinenbau Medien & Kommunikation Medizin, Gesundheit & Wellness Mode, Trends & Lifestyle PC, Information & Telekommunikation Politik, Recht & Gesellschaft Sport & Events Tourismus & Reisen Umwelt & Energie Unternehmen, Wirtschaft & Finanzen Vereine & Verbände Werbung, Marketing & Marktforschung Wissenschaft, Forschung & Technik
  Pressemitteilungen heute: 2
  Pressemitteilungen gesamt: 319.495
  Pressemitteilungen gelesen: 41.549.818x
07.06.2018 | Auto & Verkehr | geschrieben von Dipesh Batheja¹ | Pressemitteilung löschen

How to setup a WordPress blog with a Ruby on Rails web app?

These days, a great blog alongside its main web app is a must have for any SaaS provider. While Ruby on Rails is best when it comes to building a web app, WordPress is number #1 when it comes to blogging.
Why WordPress on Rails?
A blog can definitely be built using Rails itself. But WordPress is already so well optimised and ready to use in a few clicks, that you don’t need to do code a blog from scratch.

Building your own blog solution, or using some existing gems, might still be the best option if you want an entire Rails integration (login, etc…). Or maybe you particularly enjoy doing it. Or maybe you require a very simple version of a blog. Otherwise, and the vast majority of case, it is just unnecessary additional work. WordPress on Rails is the best solution for these cases.
Best Wordpress + RubyOnRails Setup
Wordpress & Rails don’t usually play nice together. So the best option is host RubyOnRails web app on your root domain and host Wordpress blog on a subdomain.

For example:

A Ruby on Rails app can be hosted on Heroku:
A Wordpress blog can hosted on WPEngine:

You can obviously host both main and sub-domain on single server as well. Netling's website ( and client login is built on RubyOnRails and our blog is running on Wordpress hosted on a single  DigitalOcean ( VPS instance managed with Plesk Onyx AdminPanel (

However, this is not an ideal situation. For maximum search engine optimisation you want your blog to be accessed as a subdirectory?—?not as a subdomain. So essentially you want to achieve something like this:

A Ruby on Rails app hosted on Heroku:
A Wordpress blog hosted on WPEngine:

This brings us to the main question,

How to host a RubyOnRails app on a root domain and a Wordpess blog on a subdomain and still be able to access blog as a sub-directory?

The answer is, put Wordpress blog behind a reverse proxy!

Setup root domain server hosting RubyOnRails app as reverse proxy to forward all requests made for your blog to subdomain running Wordpress. For example, setup as a reverse proxy to forward any requests made to to

Typically, this requires changing configuration of your Apache or NGINX instance, but we will use a handy rails gem to achieve the same results - rack-reverse-proxy ( .
On your Rails app
Add the  rack-reverse-proxy ( gem to your gemfile:
gem 'rack-reverse-proxy', :require => 'rack/reverse_proxy'
Then, you need your Rails app to redirect /blog/ to your Wordpress blog on subdomain. Go to and add the following code:
use Rack::ReverseProxy do
reverse_proxy(/^/blog(/.*)$/, '$1', opts = { preserve_host: true })
Note: Make sure you don’t have a trailing “/” in your URL. It should be $1 and not $1

Since the blog is technically hosted at /blog/, we need to forward the /blog requests there (notice the non-trailing slash).

Add to config/routes.rb:

get "/blog", to: redirect('', status: 301)

On your Wordpress blog
In your wp-config.php add following lines:

* Handle SSL reverse proxy
if ($_SERVER == 'https')

if (isset($_SERVER)) {

$_SERVER = "/blog".$_SERVER;

Voilà, you have your beautiful Wordpress blog alongside your powerful Ruby on Rails app.

Thanks for reading! I will keep it updated and add more relevant info in it as needed. If you need any help in getting this setup, don’t hesitate to tweet me: @netlings (

Bildquelle: Netlings Webworks Pvt. Ltd.

¹ Für den Inhalt der Pressemeldung/News ist allein der Verfasser verantwortlich.
Netlings Webworks Pvt. Ltd.
C-3/1, 2nd Floor, Phase-2, Ashok Vihar 42263490 110052 Delhi

Netlings Webworks Pvt. Ltd.
C-3/1, 2nd Floor, Phase-2, Ashok Vihar 42263490 110052 Delhi

Weitere Meldungen in der Kategorie "Auto & Verkehr"

| ©