damiendart/robotinaponcho/master/public/.htaccess
# ".htaccess" for Damien Dart's personal website.
#
# Copyright (C) 2013-2016 Damien Dart, <damiendart@pobox.com>.
# This file is distributed under the MIT licence. For more information,
# please refer to the accompanying "LICENCE" file.
AddDefaultCharset utf-8
DirectoryIndex gitweb.cgi index.html
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
ErrorDocument 410 /410.html
FileETag none
Options -Indexes -MultiViews
ServerSignature off
SetEnv TZ Europe/London
<IfModule mod_alias.c>
# My current host doesn't like "Redirect gone ..." for some reason,
# but "RedirectMatch gone ,,," works fine.
Redirect 301 /obtaincornhoop/style.css /assets/blog-style.css
Redirect 301 /obtaincornhoop/page-background.png /assets/blog-background.png
RedirectMatch gone /demons_souls_theodore.jpg$
RedirectMatch gone /(deadlypremonition|robotinaponcho).jpeg$
RedirectMatch gone /assets/animate.min.css$
RedirectMatch gone /assets/blog-(background.png|style.css)$
RedirectMatch gone /assets/drawings-on-tumblr-background.png$
RedirectMatch gone /assets/foc-(footer|header).html$
RedirectMatch gone /assets/glyphiconshalflings-regular.(eot|otf|svg|ttf|woff)$
RedirectMatch gone /assets/html5shiv.js$
RedirectMatch gone /assets/(jquery-1.11.3|moment|selectnav|spin).min.js$
RedirectMatch gone /assets/(obtaincornhoop|robotinaponcho)(@2x)?.png$
RedirectMatch gone /assets/(kathryn|radicalapps)@2x?.png$
RedirectMatch gone /assets/site-header(@2x)?.png$
RedirectMatch gone /crap/bastardsnake.swf$
RedirectMatch gone /crap/blog-background2?.gif$
RedirectMatch gone /crap/blog-(date|source|tags)-icon.png$
RedirectMatch gone /crap/blog-header.png$
RedirectMatch gone /crap/teamspeak-banner.jpeg$
RedirectMatch gone /crap/thingy.swf$
RedirectMatch 301 /assets/jquery-1.10.1.min.js$ /assets/jquery-1.11.3.min.js
RedirectMatch 301 /crap/(photoshop|synology)-notes.html$ /notes/$1
RedirectMatch 301 /(crap|obtaincornhoop)/glyphiconshalflings-regular.(eot|otf|svg|ttf|woff)$
/assets/glyphiconshalflings-regular.$2
RedirectMatch 301 /obtaincornhoop/(html5shiv|selectnav.min).js$ /assets/$1.js
</IfModule>
# Custom expire headers for better cache control. For more information, see
# <https://github.com/h5bp/html5-boilerplate/blob/master/.htaccess#L433>.
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 week"
ExpiresByType application/xhtml+xml "access plus 0 seconds"
ExpiresByType text/html "access plus 0 seconds"
ExpiresByType text/plain "access plus 0 seconds"
</IfModule>
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15552000;includeSubDomains" "expr=%{req_novary:X-Forwarded-Proto}=='https'"
</IfModule>
<IfModule mod_mime.c>
# Force UTF-8 encoding for other file formats.
AddCharset utf-8 .css .js
AddHandler cgi-script .git
AddType application/javascript js
AddType application/vnd.ms-fontobject eot
AddType application/x-font-ttf ttc ttf
AddType application/x-font-woff woff
AddType application/x-shockwave-flash swf
AddType font/opentype otf
AddType image/x-icon ico
AddType text/x-c c
AddType text/x-diff patch
AddType text/x-python py
AddType text/x-shellscript sh
<IfModule mod_headers.c>
# Remove unneccesary ETags; setting "FileETag None" is not enough. For more
# information, see <http://developer.yahoo.com/performance/rules.html#etags>.
Header unset ETag
</IfModule>
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
# Impelment NearlyFreeSpeech.NET's hard canonical name settings so can have
# more control over headers and stuff.
RewriteCond %{HTTP_HOST} !^www.robotinaponcho.net$ [OR]
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^.*$ https://www.robotinaponcho.net%{REQUEST_URI} [L,R=permanent]
# Remove "gitweb.cgi", "index.cgi", and "index.html" from URLs.
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{THE_REQUEST} ^.*/(gitweb.cgi|index.html)
RewriteRule ^(.*)(gitweb.cgi|index.html)$ https://www.robotinaponcho.net/$1 [L,NE,R=permanent]
# Remove query strings from URLs.
RewriteCond %{QUERY_STRING} !=""
RewriteCond %{REQUEST_URI} !^/git/
RewriteRule ^(.*)$ https://www.robotinaponcho.net/$1? [R=permanent,L]
# Remove file extensions from some URLs.
RewriteCond %{THE_REQUEST} ^.*notes/(photoshop|synology).html
RewriteRule ^(.*).html$ https://www.robotinaponcho.net/$1 [L,NE,R=permanent]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^([^.]+)$ $1.html [L,NC]
# Git web interface stuff.
RewriteCond %{REQUEST_URI} ^.*git/[a-zA-Z0-9.-_]*.git/?$
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*git/([a-zA-Z0-9.-_]*.git)/?$ https://www.robotinaponcho.net/git/?p=$1 [L,NE,R=permanent]
RewriteRule ^.*git/([a-zA-Z0-9.-_]*.git)/ - [E=GIT_PROJECT_ROOT:/home/protected/git/$1,L]
# Remove action parameter when unnecessary.
RewriteCond %{QUERY_STRING} ^(.*);a=summary(.*)$ [OR]
RewriteCond %{QUERY_STRING} ^(.*)a=project_list(.*)$
RewriteRule ^(.*)$ https://www.robotinaponcho.net/$1?%1%2 [L,NE,R=permanent]
</IfModule>
On Github License
Files