Marko Anastasov wrote this on June 26, 2009

Redirecting from the old blog

Initially we started with a Wordpress site on a subdomain for our blogging. Now that we’ve moved to our fork of Enki, when shutting down the old one it would be wise to set up URL redirection to here. That’s of course what mod_rewrite is for.

The trick is not to attempt to put any such global rewrite rule in your Rails application’s .htaccess file (ah, remember the days when Passenger didn’t play well with mod_rewrite?), but in the vhost configuration file (the one in /etc/apache2/sites-available/).

Fortunately the URLs look pretty much the same, and all it takes is a subdomain to directory kind of redirection, so it doesn’t involve a complex rule. Here’s what it looks like:

<VirtualHost *>
  ServerName www.renderedtext.com
  ServerAlias renderedtext renderedtext.com
  DocumentRoot /var/enki/public

  RewriteEngine On

  RewriteCond %{HTTP_HOST} ^blog\.renderedtext\.com [NC]
  RewriteRule ^(.*)$ http://renderedtext.com/blog$1 [R=301,L]
</VirtualHost>
comments powered by Disqus

About Marko Anastasov

Marko co-founded Rendered Text. He’s a programmer with a passion of creating something for other people, coupled with interests in how things work in the society and nature. He is having a great time working across many areas in the company, including product design, helping the engineering teams, empowering users and marketing. He likes to counterbalance it all with running, cycling or a day in the woods.

Suggested Reads

Inject is a fundamental building block

Inject is one of the fundamental, and most versatile constructs available in functional languages. It can be used to implement map, select, max, all? and a bunch of other iteration related methods. Unfortunately, many programmers are not aware of its awesome powers. This article is here to improve this fact.

Contact

Rendered Text is a software company. For questions regarding Semaphore, please visit semaphoreci.com. Otherwise, feel free to get in touch any time by sending us an email.

Rendered Text
Svetozara Miletica 10
21000 Novi Sad
Serbia