less than 1 minute read

It’s already quite a while ago that I did my last post, some still unifished drafts are pending. Anyway I have again problems with comment spam and so many updates of Drupal needed to be done. Eventually I got sick of all the updates and thought about just shutting down the site.

I finally came up with the idea to use a static site generator and convert the site. The conversion worked like a charm. But I still wanted to have the old URLs mapped to the new…

Getting the data out of the Drupal DB wasn’t that difficult and reformatting to a format that can be used by RewriteMap. The main problem was to get the RewriteRules right. It took a while of fiddling around and reading lots of sites.

Fianally I found a solution on stackoverflow that I could adopt to my specific needs.

  RewriteMap old2new "txt:/etc/apache2/blog-urlmap.txt"
  RewriteCond ${old2new:$1|NOT_FOUND} !NOT_FOUND
  RewriteRule "^/(.*)" "${old2new:$1|NOT_FOUND}" [R=301,QSA,NC,L]

So far I’m quite happy with the workflow. Writing in markdown and pushing with git works fine for me. Pending is an option for adding comments, but by now I can live with that…