RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/\.well-known/
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=permanent,L]

RewriteCond %{HTTP_HOST} ^doc.perl6.org [NC]
RewriteRule ^(.*)$ https://docs.perl6.org/$1 [R=permanent,L]

# We no longer need this, as we swapped the generator to not use the $COLONs on
# non-Windows operating systems. Since we used that earlier, rewrite in reverse
# in case someone is using the long and awful URLs
# RewriteRule ^type/(.*?)::(.*) /type/$1\$COLON\$COLON$2 [N]
RewriteRule ^type/(.*?)\$COLON\$COLON(.*) /type/$1::$2 [N]

Redirect 301 /language/5to6 https://docs.perl6.org/language/5to6-nutshell
Redirect 301 /examples      http://examples.perl6.org/
Redirect 301 /examples.html http://examples.perl6.org/
Redirect 301 /webchat       https://webchat.freenode.net/?channels=#perl6
Redirect 301 /webchat.html  https://webchat.freenode.net/?channels=#perl6
ErrorDocument 404 /404.html

<IfModule mod_deflate.c>
  SetOutputFilter DEFLATE
  AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript application/json
</IfModule>
