Skip to main content

URL-Rewriting for Octopress on Heroku

·2 mins

Time to celebrate! This blog has now its own domain rampmeupscotty.com. It was about time, since I did not like its previous domain that comes initially with Heroku, it was rampmeupscotty.herokuapp.com. Way too long.

Since I have another domain for many years with Kontent, they were my first choice. Additionally I have ordered their DNSPlus module to point DNS to my “app” on heroku.

After that, I had to tell Heroku to listen to everything that comes in with rampmeupscotty.com as its domain. In my project directory where I have all my Octopress code as well as my post I had to execute the following:

{% highlight bash langnos %} $ heroku domains:add www.rampmeupscotty.com {% endhighlight %}

Now, I had to deal with the URLs. Even when I have pointed my browser to http://www.rampmeupscotty.com the result was rampmeupscotty.herokuapp.com, the native domain as provided by Heroku. I couldn’t leave it like that of course.

This post by Adam Wiggall helped me succeeding with this task.

First I had to install bundler with:

{% highlight bash langnos %} $ gem install bundler {% endhighlight %}

Plus, I had to add the following line to my Gemfile:

{% highlight bash langnos %} $ gem ‘rack-rewrite’ {% endhighlight %}

The complete file looks as follows:

Next, I had to execute the following command to install the gem:

{% highlight bash langnos %} $ bundle install {% endhighlight %}

As the last step I had to edit config.ru by adding lines 8 and 20:

After pushing everything to Heroku, everything was as it should be. Now, you will only see www.rampmeupscotty.com when surfing through my site.

Done for today!