“...I've been working since 2008 with Ruby / Ruby on Rails, love a bit of Elixir / Phoenix and learning Rust. I also poke through other people's code and make PRs for OpenSource Ruby projects that sometimes make it. Currently working for InPay...”

Rob Lacey
Senior Software Engineer, UK

Apache Rewrite because I can never remember how to do it

I seem to use Apache less and less these days, so every year or so I have to try and remember the syntax for VirtualHost configs, redirects and the like.

<VirtualHost *:80>
  ServerName duncanwilkinson.com
  DocumentRoot /home/duncan/www.duncanwilkinson.com/
  RackEnv production
  RewriteEngine on
  RewriteCond %{HTTP_HOST} !^duncanwilkinson\.com
  RewriteRule ^/(.*)$ http://duncanwilkinson.com/$1 [R=permanent,L]
  CustomLog /var/log/apache2/loathsome-access.log combined
  ErrorLog  /var/log/apache2/loathsome-error.log
</VirtualHost>
<VirtualHost *:80>
  ServerName www.duncanwilkinson.com
  ServerAlias www.dna-labs.net dna-labs.net www.triplebinary.com triplebinary.com www.needleye.net needleye.net
  RewriteEngine on
  RedirectMatch (.*) http://duncanwilkinson.com
</VirtualHost>
<VirtualHost *:80>
  ServerName www.collapse.co
  ServerAlias collapse.co
  DocumentRoot /home/duncan/www.collapse.co/
</VirtualHost>
GPK of the Day Charred CHAD