root /home/niels/www/metanohi/web-serve;
index index.html;

error_page 404 /404.html;

location /404 {
    internal;
}

location ~ \.html$ {
    internal;
}

location / {
    # Old rewrites.
    rewrite ^/projects/aeltei https://github.com/nqpz/aeltei;
    rewrite ^/projects/alart https://github.com/nqpz/alart;
    rewrite ^/projects/alp https://github.com/nqpz/alp;
    rewrite ^/projects/bolg https://pypi.org/project/bolg/;
    rewrite ^/projects/desurveil https://pypi.org/project/desurveil/;
    rewrite ^/projects/dililatum https://github.com/nqpz/dililatum;
    rewrite ^/projects/dotbox https://github.com/nqpz/dotbox;
    rewrite ^/projects/electruth https://github.com/nqpz/electruth;
    rewrite ^/projects/exoskelegram https://pypi.org/project/exoskelegram/;
    rewrite ^/projects/forbi https://pypi.org/project/forbi/;
    rewrite ^/projects/forestquest https://github.com/nqpz/forestquest;
    rewrite ^/projects/gravnoise https://github.com/nqpz/gravnoise;
    rewrite ^/projects/hbcht https://github.com/nqpz/hbcht;
    rewrite ^/projects/htmlentitiesdecode https://pypi.org/project/htmlentitiesdecode/;
    rewrite ^/projects/indirectassassin https://github.com/nqpz/indirectassassin;
    rewrite ^/projects/kando https://pypi.org/project/kando/;
    rewrite ^/projects/kvigall https://pypi.org/project/kvigall/;
    rewrite ^/projects/movact https://github.com/nqpz/movact;
    rewrite ^/projects/naghni https://github.com/nqpz/naghni;
    rewrite ^/projects/noncrawl https://pypi.org/project/noncrawl/;
    rewrite ^/projects/pebsaq https://pypi.org/project/pebsaq/;
    rewrite ^/projects/pumila https://github.com/nqpz/pumila;
    rewrite ^/projects/sadbipws https://pypi.org/project/sadbipws/;
    rewrite ^/projects/shadowloss https://github.com/nqpz/shadowloss;
    rewrite ^/projects/yelljfish https://pypi.org/project/yelljfish/;

    rewrite ^/projects/totxt https://old-projects.metanohi.name/totxt/;
    rewrite ^/totxt https://old-projects.metanohi.name/totxt/;
    rewrite ^/totext https://old-projects.metanohi.name/totxt/;

    rewrite ^/projects/canvas https://old-projects.metanohi.name/canvas/;
    rewrite ^/canvas https://old-projects.metanohi.name/canvas/;

    rewrite ^/projects/eonaton https://old-projects.metanohi.name/eonaton/;
    rewrite ^/eonaton https://old-projects.metanohi.name/eonaton/;

    rewrite ^/projects/evolution https://old-projects.metanohi.name/evolution/;
    rewrite ^/evolution https://old-projects.metanohi.name/evolution/;

    rewrite ^/projects/snake https://old-projects.metanohi.name/snake/;
    rewrite ^/snake https://old-projects.metanohi.name/snake/;

    rewrite ^/bsq https://old-projects.metanohi.name/bsq/;

    rewrite ^/gt3000 https://old-projects.metanohi.name/gt3000/;

    rewrite ^/algo https://old-projects.metanohi.name/algo/;
    rewrite ^/algohol https://old-projects.metanohi.name/algo/;

    rewrite ^/dkstp https://old-projects.metanohi.name/dkstp/;

    rewrite ^/jap https://old-projects.metanohi.name/jap/;

    rewrite ^/pedro https://old-projects.metanohi.name/pedro/;

    rewrite ^/snowman https://old-projects.metanohi.name/snowman/;

    rewrite ^/sq https://old-projects.metanohi.name/sq/;

    rewrite ^/webcli https://old-projects.metanohi.name/webcli/;

    rewrite ^/x https://old-projects.metanohi.name/x/;

    rewrite ^/totxt https://old-projects.metanohi.name/totxt/;

    rewrite ^/aboutme /about/niels redirect;

    rewrite ^/projects/nanonote /nanonote redirect;

    rewrite ^/writings/na /Na redirect;
    rewrite ^/writings/Na\.html$ /Na redirect;

    rewrite ^/writings/digital-sikring\.html$ /digital-sikring redirect;

    rewrite ^/projects/magicng /magicng redirect;
    rewrite ^/writings/magicng /magicng redirect;

    rewrite ^/writings/atem /atem redirect;
    rewrite ^/writings/digital-sikring /digital-sikring redirect;
    rewrite ^/writings/longpoem /longpoem/ redirect;
    rewrite ^/writings/myuniverse /myuniverse/ redirect;
    rewrite ^/writings/nanonote /nanonote/ redirect;
    rewrite ^/writings/ordfinder /ordfinder/ redirect;
    rewrite ^/writings/potator /potator/ redirect;
    rewrite ^/writings/pvd /pvd/ redirect;
    rewrite ^/writings/pygame-pycairo /pygame-pycairo redirect;
    rewrite ^/writings/sound-programming /sound-programming/ redirect;
    rewrite ^/writings/stadig-digital-sikring /stadig-digital-sikring redirect;
    rewrite ^/writings/tfr /tfr/ redirect;
    rewrite ^/writings/two-spaces /two-spaces redirect;
    rewrite ^/writings/ugs /ugs/ redirect;
    rewrite ^/writings/unhappy /unhappy/ redirect;
    rewrite ^/misc / redirect;


    # Ordinary handling.
    try_files $uri $uri.html $uri/ =404;
}
