How Do I Add a WordPress Blog to My Rails App?

I wanted to have a robust blog for my Rails app, but I didn’t want to spend too much time on it. Initially I created a simple model (Articles) and added TinyMCE in it, but I ran into some challenges in how photos were displaying, and other styling aspects. I could’ve spent more time on it, but it was starting into eating into the time I was spending on developing enhancements to the app itself.

You can easily create a WordPress instance and map it to a subdomain. For example,

The problem with that, as discussed by SEO experts,, is that it can hurt your search engine optimization efforts (SEO). Instead, it’s better to use a subdirectory like:

I was able to set-up my blog this way with the help of Dipesh Batheja’s article.

Here’s the exact steps I took:

(1) Added the domain ( to a WordPress hosting account on Siteground (my host)

(2) Using cPanel on Siteground, I created a subdomain, ‘blog’ for my domain (so I now could use

(3) In cPanel, I used “Let’s Encrypt” to add an SSL certificate to my subdomain (now I could use httpS://

(4) Installed WordPress (in cPanel) to my subdomain

(5) I went to my DNS records and added two A records –, and, each pointing to the IP address of my domain on Siteground. After the DNS propagated, I could go to the URL and see my WordPress instance.

(6) In my Rails app, I added the Rack Reverse Proxy gem to my gemfile:

gem "rack-reverse-proxy", require: "rack/reverse_proxy"

(7) ‘bundle update’ to get the gem installed

(8) In config/application.rb, I added this:

config.middleware.insert(0, Rack::ReverseProxy) do 
  reverse_proxy_options force_ssl: true, replace_response_host: true

   reverse_proxy(/^\/blog(\/.*)$/, '$1', opts = { preserve_host: true })

(9) In routes.rb, I added this route:

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

(10) In WordPress, in General Settings, I set:

WordPress Address (URL):

Site Address (URL):

Now, every time someone goes to, they’re redirected to my WordPress blog, and my SEO isn’t hurt.

Upgrading Ruby on Windows with Chocolatey

I need to add an updated version of Ruby so I could use Ruby on Rails 6. I found an easy way to do this using Chocolatey. Chocolatey offers a free version for personal use.

I’ve used Railinstaller in the past to help, but it seemed that their stacks were a little outdated when I looked (and they didn’t have anything beyond Ruby 2.3).

That’s OK because using Chocolatey was super simple.

  1. Install Chocolatey
  2. You should now be able to run ‘choco install ruby’ or ‘choco upgrade ruby’ depending on what you want to do (Ruby chocolatey page)

Since I’m running URU, I just needed to add the bin path to it, and now I can switch between Ruby versions easily.

Free Quick Start Tools When Building Websites

When I’m creating a site there’s certain things that I need to create each time.

Here’s a list of some of my favorite tools – each free:

Name Generator

Namelix – enter a term (or terms) and this AI powered tool gives you name suggestions.  I usually add additional search criteria to only suggest to names with available domains

Privacy Policy

Shopify Privacy Policy Generator – create a privacy policy for your site


Terms of Use

Shopify Terms and Conditions Generator – creates terms geared more towards sites that sell products or services

Termly – can create terms geared towards SaaS products (paid and free options)


Cookie Warning/GDPR

Cookie Consent by Insites – makes it easy to create a warning to all site visitors that you use cookies


BEE Free – use their tool to create responsive email designs


Customize Form for Mailchimp

I bought a HTML template that had an email subscription form and I wanted to make it work with Mailchimp.  I wanted to keep the style of the template and not use a Mailchimp styled one.

It took some work, and I didn’t find documentation to do it, so here’s what I did:

(1) I went to my email list in Mailchimp and then Form Builder (Signup forms > Form Builder)

(2) Go to the URL provided for the form

(3) On the page that the URL takes you to (with the form), view the page source

(4) Copy these pieces of code from the source into your code:

(a) where your form should post to:

<form action="" method="POST">  

    <input type="hidden" name="u" value="foo">
    <input type="hidden" name="id" value="bar">

(b) for each field that you want to capture, find the name of the field and paste it as the name into the matching fields on the form you’re updating:

<input type="email" autocapitalize="off" autocorrect="off" name="MERGE0" id="MERGE0" size="25" value="">

(c) form submission details:

<input type="hidden" name="ht" value="foobar"> <input type="hidden" name="mc_signupsource" value="hosted">

If you submit the form and it redirects you to the web form instead of subscribing you to the list, it probably means that you have a name attribute wrong on one of your fields (and when you submitted, Mailchimp didn’t know what to do with that field).

Switching Between Ruby Versions on Windows

I had the need to handle multiple Ruby versions on my Windows PC.  I was creating a new Rails app and wanted to use the latest Ruby version, but I also needed to manage apps that used older versions.  Many developers use RVM, but it doesn’t work on Windows – so I needed a different solution.

I found URU and it works great for managing multiple Ruby versions.

I tried installing it by downloading the compressed file and running the executable included, but it didn’t work correctly.  For some reason, it created a new directory, but the directory was empty.

So instead, I used the Scoop method – downloading Scoop and then using it to install URU.

(1) After I installed URU, I added the directory to my PATH (environmental variable) on my PC.

(2) Next, I opened a CMD window, and then specified the bin directories for each Ruby version you want o use.  For example entering this on the cmd line (for each Ruby install):

uru admin add C:\ruby200\bin

(3) Then to switch between Ruby versions you enter the command, including the Ruby version (without periods):

uru 200

This will switch to Ruby 2.0.0.

You can check that you were switched by entering this command to check what version you are using:

ruby -v

The first time that I did this, I just installed the new Ruby version and I received an error telling me that my gemfile specified version 2.4.4, but I was running 2.2.1.  That was weird because when I ran ‘ruby -v’, it told me I was on 2.4.4.

It turns out, I just needed to run ‘bundle install’ to install the gems that were in the app I was trying to run, but not installed for the new Ruby version yet.

For more details on URU commands, you can read this page from the wiki.