Tag Archives: apache

mod_rewrite goodness

I had been annoyed since day one that the redirection to the blog-jail was not satisfactory and have been meaning to fix it since about then..
So today I finally got myself together and was going to set up mod_proxy once and for all.
However I had compiled apache without it, so I looked at the other modules that was compiled.
The first one that came to my mind was mod_rewrite wich I felt should be capable of filling my needs.
I was right, and it prooved to be quite powerful (as most things apache IMHO) and simple to setup.

The simple solution was to create an http root on the redirecting host for this vhost, and add AllowOverride All to its Directory options.
And in it i put a single .htaccess file with the following two lines:

RewriteEngine On
RedirectMatch ^/(.*) http://blog.henrikandersen.se:591/$1

Wich effectively sends all requests to the vhost straight over to the port that gets nat’ed in to this jail.
So now one can finally use full URL;s to posts here without adding any port as opposed to the front page redirection previously used!