URL-Rewriting for Octopress on Heroku
Time to celebrate! This blog now has its own domain,
rampmeupscotty.com. It was about time— I didn’t like
the default Heroku domain,
rampmeupscotty.herokuapp.com. Way too long.
I already had another domain with Kontent, so they were my first choice. I also ordered their DNSPlus module to point DNS to my Heroku app.
Next, I had to tell Heroku to accept requests for
rampmeupscotty.com. In my project directory (which
contains all my Octopress code and posts) I ran:
$ heroku domains:add www.rampmeupscotty.com
However, even after pointing my browser to
http://www.rampmeupscotty.com, the site redirected to
rampmeupscotty.herokuapp.com— the native Heroku domain.
I couldn’t leave it like that.
This post by Adam Wiggall helped me solve the problem.
First I installed bundler:
$ gem install bundler
Then I added this line to my Gemfile:
gem 'rack-rewrite'
The complete file looks as follows:
Gemfile
Next, I ran:
$ bundle install
Finally, I edited config.ru, adding the lines shown
at 8 and 20:
config.ru
After pushing everything to Heroku, it worked as expected. Now
the site shows only www.rampmeupscotty.com when
browsing.
Done for today!