map_hash_bucket_size 128; # https://nginx.org/en/docs/http/ngx_http_map_module.html map $request_uri $new_uri { ## library of custom redirects: ### first, manual moves, updates, mistake fixes: include /home/gwern/gwern.net/static/redirect/nginx.conf; ### then hide garbage from logs: include /home/gwern/gwern.net/static/redirect/nginx-broken.conf; } ## Rewrite https://www.gwern.net → https://gwern.net server{ #redirect www to non-www, and all other sub-domains as well (I sometimes get spurious traffic to `direct.gwern.net` etc) listen 80; listen 443 ssl; server_name *.gwern.net; ssl_certificate /home/gwern/ssl/cloudflare.cert; ssl_certificate_key /home/gwern/ssl/cloudflare.key; return 301 https://gwern.net$request_uri; } server { listen 80 default_server; listen 443 default_server ssl; server_name gwern.net; # block anyone trying to access by direct IP; this can be useful for debugging, but seems to be badly abused by bots/scanners, clogging the logs with spurious errors. So we kick them out at the start. (All legitimate users should have been redirected to the 'gwern.net' domain by this point.) if ( $host != "gwern.net" ){ return 444; # 444="CONNECTION CLOSED WITHOUT RESPONSE" } ssl_certificate /home/gwern/ssl/cloudflare.cert; ssl_certificate_key /home/gwern/ssl/cloudflare.key; root /home/gwern/gwern.net; index index; error_page 404 /404; default_type text/html; location / { limit_except GET { deny all; } # block scanners/botnets from spamming POST and other garbage location ~ ^/(confidential|private|secret|metadata/annotation/link-bibliography/%2Fconfidential|metadata/annotation/link-bibliography/%2Fprivate|metadata/annotation/link-bibliography/%2Fsecret)/ { auth_basic "Non-Public Pages"; auth_basic_user_file /etc/nginx/.htpasswd; } # for linkArchive.sh/LinkArchive.hs: ensure that no crawlers pick up my mirrors, to reduce DMCA risk. # Prevent crawlers from indexing specific directories to reduce DMCA risk # and repeat robots.txt's major rules, because Google Search appears to ignore it: location ~ ^/(doc/www/|doc/link-bibliography/|metadata/|404) { add_header X-Robots-Tag "none, noindex, nosnippet, noarchive, nocache"; } # Specific configuration for /doc/www/: WWW snapshots may accidentally match SSI includes, breaking them badly, so disable SSI just for those: location /doc/www/ { ssi off; } ## support basic MIME types include /etc/nginx/mime.types; ## support non-basic MIME types... types { text/markdown md; application/x-maff maff; text/plain conf; text/csv csv; text/x-adobe-acrobat-drm ebt; application/epub+zip epub; text/x-haskell hs; htm text/html; application/msaccess mdb; message/rfc822 mht; application/vnd.oasis.opendocument.text odt; application/vnd.oasis.opendocument.spreadsheet ods; application/vnd.oasis.opendocument.presentation odp; text/x-opml opml; text/x-patch patch; text/x-diff diff; text/x-php php; text/x-python py; text/x-r R; text/x-c c; text/plain tmpl; # PMWiki template application/vnd.rn-realmedia rm; text/plain sh; text/plain bash; application/wasm wasm; application/x-tar tar; application/font-sfnt ttf; image/x-xcf xcf; application/x-xz xz; audio/wav wav; video/mp4 mkv; application/font-sfnt otf; text/x-gtx gtx; # Gwern.net custom format } # force text files into UTF-8 to avoid 'mojibake': charset utf-8; source_charset utf-8; charset_types htm text/css text/csv text/markdown text/plain text/x-diff text/x-haskell text/x-opml text/x-patch text/x-php text/x-r text/x-shellscript text/x-gtx; ## somewhat aggressive caching: add_header Cache-Control "max-age=77760000, public, immutable"; ## RIP: (see for details on generated file) include /etc/nginx/conf.d/memoriam.conf; ## allow directory browsing, particularly useful for /doc/* autoindex on; # server-side includes : ## used in templating for the includes to avoid the need for full site rebuilds. Can just rsync up & expire cache. ssi on; # http://nginx.org/en/docs/http/ngx_http_ssi_module.html default: applies to all files served with 'text/html' MIME type # begin redirect rewrites: for cases where a more powerful regexp match-and-replace is required ## stripping query parameters: rewrite ^/static/css/fonts\.css.*$ /static/css/fonts-VERSIONED.css last; rewrite ^/static/js/head\.js$ /static/js/head-GENERATED.js last; rewrite ^/static/js/script\.js$ /static/js/script-GENERATED.js last; rewrite ^/static/css/head\.css$ /static/css/head-VERSIONED.css last; rewrite ^/static/css/style\.css$ /static/css/style-VERSIONED.css last; rewrite ^/(?[a-rt-z][a-su-z][b-z][a-su-z][a-hj-z][a-bd-z].*)\?.*$ /$old permanent; # exclude /static/ because of file versioning rewrite ^/(?.*)\?chat$ /$original permanent; rewrite ^/(?.*)\?feedback.*$ /$original permanent; rewrite ^/(?.*)\?[0-9]$ /$original permanent; rewrite ^/(?.*)\?[0-9]$ /$original permanent; rewrite ^/(?.*)\?fbclid\=.*$ /$original permanent; rewrite ^/(?.*)\?utm.*$ /$original permanent; rewrite ^/(?.*)\?ref.*$ /$original permanent; rewrite ^/(?.*)\?revision=.*$ /$original permanent; rewrite ^/(?.*)\?amp\;\?amp\;.*$ /$original permanent; rewrite ^/(?.*)\?usg=.*$ /$original permanent; rewrite ^/(?.*)\?fbid.*$ /$original permanent; rewrite ^/(?.*)\?fbclid.*$ /$original permanent; rewrite ^/(?.*)\?revisi.*$ /$original permanent; rewrite ^(?.*)\?.*callback=.*from=.*$ /$original permanent; rewrite ^(?.*)\?service=.*$ /$original permanent; rewrite ^(?.*)\?relatedposts_hit=.*$ /$original permanent; rewrite ^(?.*)\?ref.*$ /$original permanent; rewrite ^(?.*)\?code.*$ /$original permanent; rewrite ^(?.*)\?backlink.*$ /$original permanent; rewrite ^(?.*)\!$ /$original permanent; rewrite ^(?.*)ç$ /$original permanent; rewrite ^/docs/(?.*)$ /doc/$old permanent; rewrite ^/notes/(?.*)$ /note/$old permanent; rewrite ^/images/(?.*)$ /image/$old permanent; rewrite ^/reviews/(?.*)$ /review/$old permanent; rewrite ^/notes/(?.*)$ /note/$old permanent; rewrite ^/nootropics/(?.*)$ /nootropic/$old permanent; rewrite ^/doc/tominaga-nakamoto/(?.*)$ /doc/japan/history/tominaga-nakamoto/$old permanent; rewrite ^/doc/tcs/(?.*)$ /doc/psychology/neuroscience/tcs/$old permanent; rewrite ^/doc/ai/nn/transformer/clip/samplse/(?.*)$ /doc/ai/nn/transformer/clip/sample/$old permanent; rewrite ^/doc/biology/boogers/(?.*)$ /doc/biology/booger/$old permanent; rewrite ^/doc/darknet-markets/dnm-archives/(?.*)$ /doc/darknet-market/dnm-archive/$old permanent; rewrite ^/doc/darknet-markets/(?.*)$ /doc/darknet-market/$old permanent; rewrite ^/doc/genetics/heritable/rare-variants/(?.*)$ /doc/genetics/heritable/rare/$old permanent; rewrite ^/image/design/sidenotes/(?.*)$ /image/design/sidenote/$old permanent; rewrite ^/image/nootropics/(?.*)$ /image/nootropic/$old permanent; rewrite ^/image/traffic/ads/(?.*)$ /image/traffic/ad/$old permanent; rewrite ^/metadata/annotations/(?.*)$ /metadata/annotation/$old permanent; rewrite ^/metadata/annotations/backlinks/(?.*)$ /metadata/annotation/backlink/$old permanent; rewrite ^/metadata/annotations/similars/(?.*)$ /metadata/annotation/similar/$old permanent; rewrite ^/static/img/icons/(?.*)$ /static/img/icon/$old permanent; rewrite ^/static/img/scrollbars/(?.*)$ /static/img/scrollbar/$old permanent; rewrite ^/static/includes/(?.*)$ /static/include/$old permanent; rewrite ^/static/redirects/(?.*)$ /static/redirect/$old permanent; rewrite ^/static/templates/(?.*)$ /static/template/$old permanent; ## replace all spaces with hyphens: rewrite ^(.*)(\s|%20)(.*)$ $1-$3 permanent; ## fix a bunch of very obxious crawlers: rewrite ^/100-y/ALL/score/1/(?.*) /$original permanent; rewrite ^/2017/11/20/(?.*) /$original permanent; rewrite ^/BINARY/(?.*) /$original permanent; rewrite ^/Prediction-markets/(?.*) /$original permanent; rewrite ^/Red/feed/(?.*) /$original permanent; rewrite ^/Yoga.*/(?.*) /$original permanent; rewrite ^/[a-z]/(?.*) /$original permanent; rewrite ^/about/(?.*) /$original permanent; rewrite ^/advanced-search/(?.*) /$original permanent; rewrite ^/all-essays/(?.*) /$original permanent; rewrite ^/alternates/s615b/(?.*) /$original permanent; rewrite ^/amp/(?.*) /$original permanent; rewrite ^/b/(?.*) /$original permanent; rewrite ^/blog/chasing-10x-leveraging-a-poor-memory-in-software-engineering/(?.*) /$original permanent; rewrite ^/blog/everything-i-know-strategies-tips-and-tricks-for-spaced-repetition-anki/(?.*) /$original permanent; rewrite ^/border-wall/(?.*) /$original permanent; rewrite ^/card/(?.*) /$original permanent; rewrite ^/cart/(?.*) /$original permanent; rewrite ^/choice/(?.*) /$original permanent; rewrite ^/component/(?.*) /$original permanent; rewrite ^/configure/(?.*) /$original permanent; rewrite ^/contests/(?.*) /$original permanent; rewrite ^/doc/2010-crc/(?.*) /$original permanent; rewrite ^/doc/2020-crc/(?.*) /$original permanent; rewrite ^/doc/docs/(?.*) /$original permanent; rewrite ^/doc/images/(?.*) /doc/$original permanent; rewrite ^/image/images/(?.*) /images/$original permanent; rewrite ^/doc/iq/docs/(?.*) /doc/$original permanent; rewrite ^/doc/tags/(?.*) /tags/$original permanent; rewrite ^/doc/www/au.news.yahoo.com/Chrome/(?.*) /$original permanent; rewrite ^/doc/www/au.news.yahoo.com/Safari/(?.*) /$original permanent; rewrite ^/doc/www/brnensky.denik.cz/edge/(?.*) /$original permanent; rewrite ^/doc/www/play\.google\.com/(?.*) /$original permanent; rewrite ^/doc/www/play\.google\.com/\+/(?.*) /$original permanent; rewrite ^/doc/www/play\.google\.com/\_/js/(?.*) /$original permanent; rewrite ^/doc/www/play\.google\.com/\_/ss/(?.*) /$original permanent; rewrite ^/doc/www/www.adressa.no/Trident/(?.*) /$original permanent; rewrite ^/doc/www/www.belfastlive.co.uk/offline/(?.*) /$original permanent; rewrite ^/doc/www/www.dailymail.co.uk\/android-app\:\/\/com.dailymail.online/dailymail/article/2825778/(?.*) /$original permanent; rewrite ^/doc/www/www.sueddeutsche.de/edge/(?.*) /$original permanent; rewrite ^/doc/www/www.upi.com/YWRzLmxmc3RtZWRpYS5jb20vZ2V0YWQ/(?.*) /$original permanent; rewrite ^/doc/www/yuki-onna.livejournal.com/flymeango.com/(?.*) /$original permanent; rewrite ^/doc/www/yuki-onna.livejournal.com/www.arte.tv/en/(?.*) /$original permanent; rewrite ^/doc/www\/free\.law/OPR/(?.*) /$original permanent; rewrite ^/event/(?.*) /$original permanent; rewrite ^/feature/(?.*) /$original permanent; rewrite ^/find_v2/(?.*) /$original permanent; rewrite ^/fonts/(?.*) /$original permanent; rewrite ^/foo/(?.*) /$original permanent; rewrite ^/forum/(?.*) /$original permanent; rewrite ^/help/(?.*) /help permanent; rewrite ^/homepage-test/(?.*) /$original permanent; rewrite ^/in-depth/(?.*) /$original permanent; rewrite ^/initiatives/(?.*) /$original permanent; rewrite ^/live-blog/(?.*) /$original permanent; rewrite ^/login/(?.*) /$original permanent; rewrite ^/m/(?.*) /$original permanent; rewrite ^/my-account/(?.*) /$original permanent; rewrite ^/opinion/(?.*) /$original permanent; rewrite ^/p/(?.*) /$original permanent; rewrite ^/partner_content/(?.*) /$original permanent; rewrite ^/performer/(?.*) /$original permanent; rewrite ^/poisoned-cities/(?.*) /$original permanent; rewrite ^/privacy/(?.*) /$original permanent; rewrite ^/products/(?.*) /$original permanent; rewrite ^/satellites/bible/(?.*) /$original permanent; rewrite ^/source/I0.*/(?.*) /$original permanent; rewrite ^/source/LP.*/(?.*) /$original permanent; rewrite ^/soylent/library/death/suicide/famous/(?.*) /$original permanent; rewrite ^/soylent/library/travel/cities/nyc/(?.*) /$original permanent; rewrite ^/sponsored/(?.*) /$original permanent; rewrite ^/sponsored_sections/(?.*) /$original permanent; rewrite ^/static/docs/(?.*) /doc/$original permanent; rewrite ^/store/configure/xbox-design-lab/(?.*) /$original permanent; rewrite ^/stylesheets/(?.*) /$original permanent; rewrite ^/terms/(?.*) /$original permanent; rewrite ^/trust/(?.*) /$original permanent; rewrite ^/videos/(?.*) /$original permanent; rewrite ^/wp-content/(?.*) /$original permanent; rewrite ^/locales/(?.*) /$original permanent; rewrite ^/merchants/(?.*) /$original permanent; rewrite ^/strong-opinions-weakly-held/(?.*) /$original permanent; rewrite ^/uris/(?.*) /$original permanent; rewrite ^/_uris/(?.*) /$original permanent; rewrite ^/instances/(?.*) /$original permanent; rewrite ^/_pages/(?.*) /$original permanent; rewrite ^/partner/(?.*) /$original permanent; rewrite ^/services/(?.*) /$original permanent; rewrite ^/v/(?.*) /$original permanent; rewrite ^/v2/(?.*) /$original permanent; rewrite ^/articles/(?.*) /$original permanent; rewrite ^/\/(?.*)$ /$original permanent; rewrite ^/doc/sr/\^/live/(?.*) /$original permanent; rewrite ^/doc/www/old.reddit.com/\^/live/(?.*) /$original permanent; rewrite ^/doc/www/market.android.com/(?.*) /$original permanent; rewrite ^/doc/www/market.android.com/Edg/(?.*) /$original permanent; rewrite ^/doc/www/market.android.com/_/js/(?.*) /$original permanent; rewrite ^/doc/www/market.android.com/_/ss/(?.*) /$original permanent; rewrite ^/doc/www/market.android.com/type.googleapis.com/(?.*) /$original permanent; rewrite ^/doc/www/market.android.com/\+/(?.*) /$original permanent; rewrite ^/doc/www/www.google.com/\+/(?.*) /$original permanent; rewrite ^/doc/www/www.google.com/Edg/(?.*) /$original permanent; rewrite ^/doc/www/www.lenovo.com/Yoga.*/p/(?.*) /$original permanent; rewrite ^/doc/www/www.supermemo.com/Trident/(?.*) /$original permanent; rewrite ^/doc/www/www.thedenverchannel.com/Trident/(?.*) /$original permanent; rewrite ^/doc/www/www.baltimoresun.com/Trident/(?.*) /$original permanent; rewrite ^/articleComments/(?.*) /$original permanent; rewrite ^/43010785/wallanews/innerpages/(?.*) /$original permanent; rewrite ^/bucket/3067d498bc60d7bdfa033571e782efbcf5b28c5c/(?.*) /$original permanent; rewrite ^/connecticut/norwalk/police-fire/norwalk-police-bust-major-marijuana-operation-after-finding-pot-in-mail/(?.*) /$original permanent; rewrite ^/doc/www/au.news.yahoo.com/Chromium/(?.*) /$original permanent; rewrite ^/doc/www/drugs.globalincidentmap.com/(?.*) /$original permanent; rewrite ^/weather/(?.*) /$original permanent; rewrite ^/connecticut/norwalk/(?.*) /$original permanent; rewrite ^/2017/(?.*) /$original permanent; rewrite ^/doc/www/groups.google.ca/+/(?.*) /$original permanent; rewrite ^/doc/www/groups.google.*/(?.*) /$original permanent; rewrite ^/doc/www/blogs.msdn.microsoft.com/CriOS/(?.*) /$original permanent; rewrite ^/doc/www/blogs.msdn.microsoft.com/Edge/(?.*) /$original permanent; rewrite ^/doc/www/blogs.msdn.microsoft.com/Firefox/(?.*) /$original permanent; rewrite ^/doc/www/blogs.msdn.microsoft.com/IEMobile/(?.*) /$original permanent; rewrite ^/doc/www/blogs.msdn.microsoft.com/Silk/(?.*) /$original permanent; rewrite ^/doc/www/blogs.msdn.microsoft.com/Chrome/(?.*) /$original permanent; rewrite ^/doc/www/blogs.msdn.microsoft.com/Version/(?.*) /$original permanent; rewrite ^/doc/www/blogs.msdn.microsoft.com/WebKit/(?.*) /$original permanent; rewrite ^/doc/www/bgr.com/Version/(?.*) /$original permanent; rewrite ^/community-static/8891523-register/(?.*) /$original permanent; rewrite ^/community-static/4805458-metroland-media-group-commenting-guidelines/(?.*) /$original permanent; rewrite ^/community-static/2545471-mississauga-about-us/(?.*) /$original permanent; rewrite ^/2015/04/21/sane-finds-100-hits-of-lsd-during-petoskey-search/(?.*) /$original permanent; rewrite ^/article/dn8317-meditation-builds-up-the-brain/(?.*) /$original permanent; rewrite ^/app.php/mentionloc/(?.*) /$original permanent; rewrite ^/ark:/67531/metadc.*/(?.*) /$original permanent; rewrite ^/article/dn14249-interview-its-a-dogs-life-again/(?.*) /$original permanent; rewrite ^/datapreview/(?.*) /$original permanent; rewrite ^/display/heraldsun.com.au/(?.*) /$original permanent; rewrite ^/quot./(?.*) /$original permanent; rewrite ^/quot.(?.*) $original permanent; rewrite ^/wcsstore/PetcoStore/(?.*) /$original permanent; rewrite ^/transcript/(?.*) /$original permanent; rewrite ^/static-assets/(?.*) /$original permanent; rewrite ^/source/.*/(?.*) /$original permanent; rewrite ^/region/(?.*) /$original permanent; rewrite ^/profile/papers/(?.*) /$original permanent; rewrite ^/profile/collections/(?.*) /$original permanent; rewrite ^/profile/(?.*) /$original permanent; rewrite ^/money/(?.*) /$original permanent; rewrite ^/reviews/soy-isoflavones_red-clover_black-cohosh_supplements/phytoestrogens/(?.*) /$original permanent; rewrite ^/reviews/turmeric-curcumin-supplements-spice-review/turmeric/(?.*) /$original permanent; rewrite ^/reviews/Vitamin_A_Retinol_Beta-Carotene_Cod_Liver_Oil/Vitamin_A/(?.*) /$original permanent; rewrite ^/journal/revw.*/(?.*) /$original permanent; rewrite ^/jfe/(?.*) /$original permanent; rewrite ^/explore/partners/TAMS/browse/(?.*) /$original permanent; rewrite ^/en/account/management/(?.*) /$original permanent; rewrite ^/embed/(?.*) /$original permanent; rewrite ^/doc/www/www.petco.com/images/colors/color1/(?.*) /$original permanent; rewrite ^/reviews/Wellbutrin_vs_Generic_Bupropion/Wellbutrin/(?.*) /$original permanent; rewrite ^/review/reviews/(?.*) /reviews/$original permanent; rewrite ^/reviewsfood-testing/.*/(?.*) /$original permanent; rewrite ^/doc/www/www.instagram.com/android-app.*/(?.*) /$original permanent; rewrite ^/client_error/(?.*) /$original permanent; rewrite ^/doc/www/support.google.com/\+/(?.*) /$original permanent; rewrite ^/article./.*/(?.*) /$original permanent; rewrite ^/WebGraphics/(?.*) /$original permanent; rewrite ^/subscribe-more/(?.*) /$original permanent; rewrite ^/pt/home/(?.*) /$original permanent; rewrite ^/soundcloud-tpa/(?.*) /$original permanent; rewrite ^/doc/www/www3.bostonglobe.com/.*/(?.*) /$original permanent; rewrite ^/doc/www/www.allinea.com/.*/(?.*) /$original permanent; rewrite ^/doc/www/highqualityevidence.blogspot.com/.*/(?.*) /$original permanent; rewrite ^/doc/www/newcriterion.com/.*\.com/(?.*) /$original permanent; rewrite ^/doc/www/support.google.com/gm/(?.*) /$original permanent; rewrite ^/subscribe/(?.*) /$original permanent; rewrite ^/story/[0-9]+/(?.*) /$original permanent; rewrite ^/static/bundles/(?.*) /$original permanent; rewrite ^/pages/feedback/(?.*) /$original permanent; rewrite ^/onward/notify/(?.*) /$original permanent; rewrite ^/members/exclusives/(?.*) /$original permanent; rewrite ^/embedded-video/(?.*) /$original permanent; rewrite ^/elections/chatbot/(?.*) /$original permanent; rewrite ^/iq-tests/(?.*) /$original permanent; rewrite ^/doc/www/external/languages-dist/smart/(?.*) /$original permanent; rewrite ^/doc/www/researchnews.osu.edu/player.vimeo.com/video/(?.*) /$original permanent; rewrite ^/doc/www/support.google.com/Edg/(?.*) /$original permanent; rewrite ^/outdoor-adventure/exploration/the-king-of-the-ferret-leggers/(?.*) /$original permanent; rewrite ^/food-testing/laboratories/eurofins-food-integrity-and-innovation/(?.*) /$original permanent; rewrite ^/.*/Trident/(?.*) /$original permanent; rewrite ^/(?.*)\$$ /$original permanent; rewrite ^/(?.*)\)$ /$original permanent; rewrite ^/(?.*)\)\)$ /$original permanent; rewrite ^/(?.*)\($ /$original permanent; rewrite ^/(?.*)\.$ /$original permanent; rewrite ^/(?.*),$ /$original permanent; rewrite ^/(?.*)_$ /$original permanent; rewrite ^/(?.*)-$ /$original permanent; rewrite ^/(?.*)\;$ /$original permanent; rewrite ^/(?.*)\+$ /$original permanent; rewrite ^/article/.*(?.*) /$original permanent; rewrite ^/(?.*)\%26amp\;quot\; /$original permanent; rewrite ^/\%26amp\;quot\;(?.*) /$original permanent; rewrite ^/.*\%26amp\;quot\;(?.*) /$original permanent; rewrite ^/newsletter/2020/%26amp\;quot\;https\:\/\/.*/(?.*) /$original permanent; rewrite ^/(?.*).djvu$ /$original.pdf permanent; rewrite ^/(?.*)/index/$ /$original/index permanent; rewrite ^/(?.*)/.html/$ /$original.html permanent; rewrite ^/(?.*)/.pdf/$ /$original.pdf permanent; rewrite ^/(?.*)/.pdff$ /$original.pdf permanent; ## rewrite mistaken newsletter URLs like '/newsletter/2019/7' to '/newsletter/2019/07': rewrite ^/newsletter/(?20[0-5][0-9])/(?[0-9])$ /newsletter/$originalYear/0$originalMonth permanent; rewrite ^/.*/%c3%a2%c2%80%c2%98.*/(?.*) /$original permanent; rewrite ^/(?.*)-ORDER-BY-.*/ /$original permanent; rewrite ^/newsletter/2[0-9][0-9][0-9]/docs/www/(?.*) /doc/www/$original permanent; rewrite ^/[a-zA-Z].*/static/js/(?.*\.js)$ /static/js/$original permanent; rewrite ^/.*\|\.\/\/(?.*) /$original permanent; rewrite ^/\%26amp\;quot\;.*/(?.*) /$original permanent; rewrite ^/\%26amp\;.*quot\;.*/(?.*) /$original permanent; rewrite ^/(?.*)\"$ /$original permanent; rewrite ^/(?.*)\&[a-z][a-z]=.*$ /$original permanent; rewrite ^/(?.*)\.pag$ /$original.md permanent; rewrite ^/\.\/doc/(?.*) /$original permanent; rewrite ^/(?.*)\=$ /$original permanent; # rewrite ^/(?.*)\%[0-9]C.*$ /$original permanent; # rewrite ^/(?.*)\%[0-9]D.*$ /$original permanent; # rewrite ^/(?.*)\%[0-9]F.*$ /$original permanent; # rewrite ^/(?.*)\%5D$ /$original permanent; rewrite ^/(?.*)\[Aa]cessed$ /$original permanent; # rewrite ^/(?.*)\%5C.*$ /$original permanent; # rewrite ^/(?.*)%5C.*$ /$original permanent; # rewrite ^/(?.*)\\$ /$original permanent; # rewrite "^(?.*?)[\\%5C]+$" $scheme://$host$original permanent; rewrite ^/(?.*)\|$ /$original permanent; rewrite ^/\/(?.*)$ /$original permanent; rewrite ^/\/\/(?.*)$ /$original permanent; rewrite ^/\/\/\/(?.*)$ /$original permanent; rewrite ^/.*-https:\/\/www.gwern.net/(?.*)$ /$original permanent; rewrite ^/blob/master/(?.*)$ /$original permanent; rewrite ^/doc/.*/(?docs/www/.*)$ /$original permanent; rewrite ^/does/(?.*)$ /doc/$original permanent; rewrite ^/(?doc/.*/[12].*\.pd)$ /$original\f permanent; rewrite ^/tag/.*/(?.*)$ /tags/$original permanent; rewrite ^/(?.*)­(?.*)$ /$original1-$original2 permanent; rewrite ^/(?doc/.*)--(?.*pdf)$ /$original1-$original2 permanent; # wandb.ai likes double-dashes? rewrite ^/(?.*)—(?.*)$ /$original1-$original2 permanent; rewrite ^/doc/rotten.com/library/bio/crime/killer-moms/darlie-routier/(?.*) /doc/rotten.com/library/bio/crime/criminals/darlie-routier/$original permanent; rewrite ^/doc/rotten.com/library/bio/authors/Richard_Scarry/(?.*) /doc/rotten.com/library/bio/authors/richard-scarry/$original permanent; rewrite ^/doc/rotten.com/library/bio/crime/serial-killers/Fred_and_Rosemary_West/(?.*) /doc/rotten.com/library/bio/crime/serial-killers/wests/$original permanent; rewrite ^/dos/(?.*) /doc/$original permanent; rewrite ^/GPT-2-Folk-Music-\%C2\%B7-Gwern\.net_files/(?.*) /doc/ai/music/$original permanent; rewrite ^/(?.*)/%E2%80%8B(?.*)$ /$original1/$original2 permanent; rewrite ^/(?.*)%E2%80%8B(?.*)$ /$original1$original2 permanent; rewrite ^/index/(?.*)$ /$original permanent; rewrite ^/(?.*)\~$ /$original permanent; rewrite ^/(?.*)\:$ /$original permanent; rewrite ^/(?.*),page$ /$original.md permanent; rewrite ^/(?.*)\.markdown$ /$original.md permanent; rewrite ^/(?.*)\.source$ /$original.md permanent; rewrite ^/(?.*)\$ $original.md permanent; rewrite ^/-(?.*)$ /$original permanent; rewrite ^/(?.*)\.tmp$ /$original permanent; rewrite ^/(?.*)\.pd\/f$ /$original.pdf permanent; rewrite ^/(?.*)https:\/\/www\.gwern\.net\/.*$ /$original permanent; rewrite ^/(?.*)&imgrefurl.*$ /$original permanent; rewrite ^/(?.*)\]$ /$original permanent; rewrite ^/(?.*)\<.*$ /$original permanent; rewrite ^/(?.*)\>.*$ /$original permanent; rewrite ^/(?doc/.*/)[0-9][0-9][0-9][0-9]$ /$original permanent; rewrite ^/(?doc/.*/)[0-9][0-9][0-9][0-9]-$ /$original permanent; rewrite ^/doc/www.rotten.com/(?.*)$ /doc/rotten.com/$original permanent; rewrite ^/(?doc/.*)\.pd$ /$original.pdf permanent; rewrite ^/(?doc/.*)\.p$ /$original.pdf permanent; rewrite ^/(?doc/.*)\/pdf.*$ /$original.pdf permanent; rewrite ^/(?doc/.*)\.pd$ /$original.pdf permanent; rewrite ^/(?doc/.*)\.p$ /$original.pdf permanent; rewrite ^/(?doc/.*)\.\.\.$ /$original.pdf permanent; rewrite ^/(?doc/.*)…$ /$original.pdf permanent; rewrite ^/(?doc/.*\.pdf)…$ /$original permanent; rewrite ^/(?.*)\*\*$ /$original permanent; rewrite ^/(?.*)\*$ /$original permanent; rewrite ^/(?.*)\&lang=en$ /$original permanent; rewrite ^/(?.*)\&sa=.*$ /$original permanent; rewrite ^/doc/eva/doc/eva/(?.*)$ /doc/eva/$original permanent; rewrite ^/(?.*)\&lang=en$ /$original permanent; rewrite ^/image%25252F(?.*)$ /images/$original permanent; rewrite ^/image%25252Fthumbnails%25252Fwikipedia%25252F(?.*)$ /images/thumbnails/wikipedia/$original permanent; rewrite ^/(?doc/.*\.pdf)The$ /$original permanent; rewrite ^/(?.*)\&spec\=ft100x75$ /$original permanent; rewrite ^/(?.*)\'A\=0$ /$original permanent; rewrite ^/(?.*)\&usg=.*$ /$original permanent; rewrite ^/(?.*)\&$ /$original permanent; rewrite ^/(?.*)\+\&cd\=.*$ /$original permanent; rewrite ^/(?.*)\&ved\=.*$ /$original permanent; rewrite ^/(?.*)\&xid\=.*$ /$original permanent; rewrite ^/(?.*)\&fbid.*$ /$original permanent; rewrite ^/(?.*)\&fbclid.*$ /$original permanent; rewrite ^/(?.*)\&key=.*$ /$original permanent; rewrite ^/(?.*)\&id\=.*$ /$original permanent; rewrite ^/(?.*)\%E2\%80\%99$ /$original permanent; rewrite ^/(?.*)\%60$ /$original permanent; rewrite ^/(?.*)// /$original/ permanent; # match surprising pervasive errors of appending an entire URL, like '/doc/culture/2012-russell.pdfhttps://www.google.com/amp/s/www.oprahmag.com/life/health/amp27336010/rewatching-old-reruns-is-good-for-your-health-study/index.html' rewrite ^/(?doc/.*\.pdf)http.*$ /$original permanent; rewrite ^/(?doc/.*\.html)http.*$ /$original permanent; rewrite ^/(?.*\.pdf)\.pdf$ /$original permanent; rewrite ^/(?.*)/index\.html\?KEY1\[KEY2\]\=VALUE0$ /$original permanent; rewrite ^/(?.*)http$ /$original permanent; rewrite ^/(?.*)https$ /$original permanent; rewrite ^/(?.*)_$ /$original permanent; rewrite ^/(?.*)__$ /$original permanent; rewrite ^/static/js/(?.*)\.js\.map$ /static/js/$original permanent; rewrite ^/doc/(?.*\.pdf)/index.*$ /doc/$original permanent; rewrite ^/doc/(?.*\.pdf)/$ /doc/$original permanent; rewrite ^/doc/(?.*\.html)/$ /doc/$original permanent; rewrite ^/doc/(?.*\.html)/index$ /doc/$original permanent; rewrite ^/(?.*)\&hl\=en$ /$original permanent; rewrite ^/[A-Z].*(?/tags/.*) /$original permanent; rewrite ^/(?doc/.*/index)/index.html /$original permanent; rewrite ^/newsletter/(?2[0-9][0-9][0-9]/[01][0-9])/index.html /newsletter/$original permanent; rewrite ^/(?.*)\<$ /$original permanent; rewrite ^/(?.*)\>$ /$original permanent; rewrite ^/en/about/cookies/(?.*) /$original permanent; rewrite ^/en/activities/(?.*) /$original permanent; rewrite ^/en/datasets/(?.*) /$original permanent; rewrite ^/en/clippings/(?.*) /$original permanent; rewrite ^/en/organisations/(?.*) /$original permanent; rewrite ^/en/persons/(?.*) /$original permanent; rewrite ^/en/prizes/(?.*) /$original permanent; rewrite ^/en/publications/(?.*) /$original permanent; rewrite ^/en/(?.*) /$original permanent; rewrite ^/img/(?.*) /static/img/$original permanent; rewrite ^/(?.*)Cache /$original permanent; rewrite ^/dics/(?.*) /doc/$original permanent; rewrite ^/doc/catnip/(?.*) /doc/cat/$original permanent; rewrite ^/doc/sr/pickard/(?.*) /doc/darknet-markets/william-pickard/$original permanent; rewrite ^/doc/lwsurvey/hpmor/(?.*) /doc/lesswrong-survey/hpmor/$original permanent; rewrite ^/doc/histoy/(?.*) /doc/history/$original permanent; rewrite ^/doc/rl/armstrong-controlproblem/ /doc/reinforcement-learning/armstrong-controlproblem/$original permanent; rewrite ^/(?doc/.*)/index/index.html /$original/index permanent; rewrite ^/(?doc/.*)\.pd/f.$ /$original.pdf permanent; rewrite ^/(?doc/.*)\.pd\\\f.*$ /$original.pdf permanent; rewrite ^/(?doc/.*)-pdf$ /$original.pdf permanent; rewrite ^/(?.*)https://www.gwern.net.*$ /$original permanent; # eg. '/CO2-Coinhttps://gwern.net/CO2-Coin' rewrite ^/(?.*)\{$ /$original permanent; rewrite ^/(?.*)\}$ /$original permanent; rewrite ^/(?.*)\.$ /$original permanent; rewrite ^/(?.*)\;$ /$original permanent; rewrite ^/(?.*)\,$ /$original permanent; rewrite ^/(?.*)\"$ /$original permanent; rewrite ^/(?.*)\'$ /$original permanent; rewrite ^/(?.*)\.Pdf$ /$original.pdf permanent; rewrite ^/(?.*)\.PDf$ /$original.pdf permanent; rewrite ^/(?.*)\.PDF$ /$original.pdf permanent; rewrite ^/(?.*)\.pDF$ /$original.pdf permanent; rewrite ^/(?.*)\.pdF$ /$original.pdf permanent; rewrite ^/(?.*)undefined$ /$original permanent; # deal en masse with spam hits from local Reddit archives rewrite ^/DotA2/(?.*)$ https://old.reddit.com/r/DotA2/$original permanent; rewrite ^/place/(?.*)$ https://old.reddit.com/r/place/$original permanent; rewrite ^/AIDungeon/(?.*)$ https://old.reddit.com/r/AIDungeon/$original permanent; rewrite ^/AnimalsBeingDerps/(?.*)$ https://old.reddit.com/r/AnimalsBeingDerps/$original permanent; rewrite ^/Bitcoin/(?.*)$ https://old.reddit.com/r/Bitcoin/$original permanent; rewrite ^/CucumbersScaringCats/(?.*)$ https://old.reddit.com/r/CucumbersScaringCats/$original permanent; rewrite ^/DIY_eJuice/(?.*)$ https://old.reddit.com/r/DIY_eJuice/$original permanent; rewrite ^/DecisionTheory/(?.*)$ https://old.reddit.com/r/DecisionTheory/$original permanent; rewrite ^/Futurology/(?.*)$ https://old.reddit.com/r/Futurology/$original permanent; rewrite ^/GPT3/(?.*)$ https://old.reddit.com/r/GPT3/$original permanent; rewrite ^/HPMOR/(?.*)$ https://old.reddit.com/r/HPMOR/$original permanent; rewrite ^/HobbyDrama/(?.*)$ https://old.reddit.com/r/HobbyDrama/$original permanent; rewrite ^/IAmA/(?.*)$ https://old.reddit.com/r/IAmA/$original permanent; rewrite ^/IncreasinglyVerbose/(?.*)$ https://old.reddit.com/r/IncreasinglyVerbose/$original permanent; rewrite ^/LSD/(?.*)$ https://old.reddit.com/r/LSD/$original permanent; rewrite ^/LessWrong/(?.*)$ https://old.reddit.com/r/LessWrong/$original permanent; rewrite ^/MEMarketplace/(?.*)$ https://old.reddit.com/r/MEMarketplace/$original permanent; rewrite ^/MLPtunes/(?.*)$ https://old.reddit.com/r/MLPtunes/$original permanent; rewrite ^/MachineLearning/(?.*)$ https://old.reddit.com/r/MachineLearning/$original permanent; rewrite ^/MapPorn/(?.*)$ https://old.reddit.com/r/MapPorn/$original permanent; rewrite ^/MediaSynthesis/(?.*)$ https://old.reddit.com/r/MediaSynthesis/$original permanent; rewrite ^/NavySealCopypasta/(?.*)$ https://old.reddit.com/r/NavySealCopypasta/$original permanent; rewrite ^/Parahumans/(?.*)$ https://old.reddit.com/r/Parahumans/$original permanent; rewrite ^/Perfectfit/(?.*)$ https://old.reddit.com/r/Perfectfit/$original permanent; rewrite ^/Pets/(?.*)$ https://old.reddit.com/r/Pets/$original permanent; rewrite ^/Piracy/(?.*)$ https://old.reddit.com/r/Piracy/$original permanent; rewrite ^/PrequelMemes/(?.*)$ https://old.reddit.com/r/PrequelMemes/$original permanent; rewrite ^/Psychonaut/(?.*)$ https://old.reddit.com/r/Psychonaut/$original permanent; rewrite ^/QuantifiedSelf/(?.*)$ https://old.reddit.com/r/QuantifiedSelf/$original permanent; rewrite ^/QuantikXanax/(?.*)$ https://old.reddit.com/r/QuantikXanax/$original permanent; rewrite ^/Re_Zero/(?.*)$ https://old.reddit.com/r/Re_Zero/$original permanent; rewrite ^/SDAM/(?.*)$ https://old.reddit.com/r/SDAM/$original permanent; rewrite ^/SampleSize/(?.*)$ https://old.reddit.com/r/SampleSize/$original permanent; rewrite ^/Scholar/(?.*)$ https://old.reddit.com/r/Scholar/$original permanent; rewrite ^/Scotland/(?.*)$ https://old.reddit.com/r/Scotland/$original permanent; rewrite ^/SheepMarketplace/(?.*)$ https://old.reddit.com/r/SheepMarketplace/$original permanent; rewrite ^/SilkRoad/(?.*)$ https://old.reddit.com/r/SilkRoad/$original permanent; rewrite ^/SpiceandWolf/(?.*)$ https://old.reddit.com/r/SpiceandWolf/$original permanent; rewrite ^/StartledCats/(?.*)$ https://old.reddit.com/r/StartledCats/$original permanent; rewrite ^/SubSimulatorGPT2/(?.*)$ https://old.reddit.com/r/SubSimulatorGPT2/$original permanent; rewrite ^/SubSimulatorGPT2Meta/(?.*)$ https://old.reddit.com/r/SubSimulatorGPT2Meta/$original permanent; rewrite ^/Supplements/(?.*)$ https://old.reddit.com/r/Supplements/$original permanent; rewrite ^/TOR/(?.*)$ https://old.reddit.com/r/TOR/$original permanent; rewrite ^/TOUHOUMUSIC/(?.*)$ https://old.reddit.com/r/TOUHOUMUSIC/$original permanent; rewrite ^/TheMotte/(?.*)$ https://old.reddit.com/r/TheMotte/$original permanent; rewrite ^/TomMarketplace/(?.*)$ https://old.reddit.com/r/TomMarketplace/$original permanent; rewrite ^/Tulpas/(?.*)$ https://old.reddit.com/r/Tulpas/$original permanent; rewrite ^/UnresolvedMysteries/(?.*)$ https://old.reddit.com/r/UnresolvedMysteries/$original permanent; rewrite ^/WTF/(?.*)$ https://old.reddit.com/r/WTF/$original permanent; rewrite ^/WeAreTheMusicMakers/(?.*)$ https://old.reddit.com/r/WeAreTheMusicMakers/$original permanent; rewrite ^/atlantis/(?.*)$ https://old.reddit.com/r/atlantis/$original permanent; rewrite ^/electronic_cigarettes/(?.*)$ https://old.reddit.com/r/electronic_cigaretttes/$original permanent; rewrite ^/estimation/(?.*)$ https://old.reddit.com/r/estimation/$original permanent; rewrite ^/fitnesscirclejerk/(?.*)$ https://old.reddit.com/r/fitnesscirclejerk/$original permanent; rewrite ^/genewolfe/(?.*)$ https://old.reddit.com/r/genewolfe/$original permanent; rewrite ^/grams/(?.*)$ https://old.reddit.com/r/grams/$original permanent; rewrite ^/hangovereffect/(?.*)$ https://old.reddit.com/r/hangovereffect/$original permanent; rewrite ^/haskell_proposals/(?.*)$ https://old.reddit.com/r/haskell_proposals/$original permanent; rewrite ^/havanamarket/(?.*)$ https://old.reddit.com/r/havanamarket/$original permanent; rewrite ^/holdmycatnip/(?.*)$ https://old.reddit.com/r/holdmycatnip/$original permanent; rewrite ^/interestingasfuck/(?.*)$ https://old.reddit.com/r/interestingasfuck/$original permanent; rewrite ^/kratom/(?.*)$ https://old.reddit.com/r/kratom/$original permanent; rewrite ^/lowlevelaware/(?.*)$ https://old.reddit.com/r/lowlevelaware/$original permanent; rewrite ^/math/(?.*)$ https://old.reddit.com/r/math/$original permanent; rewrite ^/medsforbitcoin/(?.*)$ https://old.reddit.com/r/medsforbitcoin/$original permanent; rewrite ^/microdosing/(?.*)$ https://old.reddit.com/r/microdosing/$original permanent; rewrite ^/minimalism/(?.*)$ https://old.reddit.com/r/minimalism/$original permanent; rewrite ^/mlscaling/(?.*)$ https://old.reddit.com/r/mlscaling/$original permanent; rewrite ^/modup/(?.*)$ https://old.reddit.com/r/modup/$original permanent; rewrite ^/mylittlepony/(?.*)$ https://old.reddit.com/r/mylittlepony/$original permanent; rewrite ^/neography/(?.*)$ https://old.reddit.com/r/neography/$original permanent; rewrite ^/neuro/(?.*)$ https://old.reddit.com/r/neuro/$original permanent; rewrite ^/onions/(?.*)$ https://old.reddit.com/r/onions/$original permanent; rewrite ^/philosophy/(?.*)$ https://old.reddit.com/r/philosophy/$original permanent; rewrite ^/programming/(?.*)$ https://old.reddit.com/r/programming/$original permanent; rewrite ^/r/haskell/(?.*)$ https://old.reddit.com/r/haskell/$original permanent; rewrite ^/rational/(?.*)$ https://old.reddit.com/r/rational/$original permanent; rewrite ^/reinforcementlearning/(?.*)$ https://old.reddit.com/r/reinforcementlearning/$original permanent; rewrite ^/researchchemicals/(?.*)$ https://old.reddit.com/r/researchchemicals/$original permanent; rewrite ^/sanitariummarket/(?.*)$ https://old.reddit.com/r/sanitariummarket/$original permanent; rewrite ^/science/(?.*)$ https://old.reddit.com/r/science/$original permanent; rewrite ^/skeptic/(?.*)$ https://old.reddit.com/r/skeptic/$original permanent; rewrite ^/slatestarcodex/(?.*)$ https://old.reddit.com/r/slatestarcodex/$original permanent; rewrite ^/startups/(?.*)$ https://old.reddit.com/r/startups/$original permanent; rewrite ^/statistics/(?.*)$ https://old.reddit.com/r/statistics/$original permanent; rewrite ^/techsupport/(?.*)$ https://old.reddit.com/r/techsupport/$original permanent; rewrite ^/themarketplace/(?.*)$ https://old.reddit.com/r/themarketplace/$original permanent; rewrite ^/touhou/(?.*)$ https://old.reddit.com/r/touhou/$original permanent; rewrite ^/transhumanism/(?.*)$ https://old.reddit.com/r/transhumanism/$original permanent; rewrite ^/trees/(?.*)$ https://old.reddit.com/r/trees/$original permanent; rewrite ^/unsong/(?.*)$ https://old.reddit.com/r/unsong/$original permanent; rewrite ^/wholesomeanimememes/(?.*)$ https://old.reddit.com/r/wholesomeanimememes/$original permanent; rewrite ^/wholesomeanimemes/(?.*)$ https://old.reddit.com/r/wholesomeanimemes/$original permanent; rewrite ^/wikipedia/(?.*)$ https://old.reddit.com/r/wikipedia/$original permanent; rewrite ^/conspiracy/(?.*)$ https://old.reddit.com/r/conspiracy/$original permanent; rewrite ^/deepdream/(?.*)$ https://old.reddit.com/r/deepdream/$original permanent; rewrite ^/StableDiffusion/(?.*)$ https://old.reddit.com/r/StableDiffusion/$original permanent; rewrite ^/typography/(?.*)$ https://old.reddit.com/r/typography/$original permanent; rewrite ^/bigsleep/(?.*)$ https://old.reddit.com/r/bigsleep/$original permanent; rewrite ^/CrappyDesign/(?.*)$ https://old.reddit.com/r/CrappyDesign/$original permanent; rewrite ^/DiscoDiffusion/(?.*)$ https://old.reddit.com/r/DiscoDiffusion/$original permanent; rewrite ^/HentaiDiffusion/(?.*)$ https://old.reddit.com/r/HentaiDiffusion/$original permanent; rewrite ^/Lettering/(?.*)$ https://old.reddit.com/r/Lettering/$original permanent; rewrite ^/Openaijukebox/(?.*)$ https://old.reddit.com/r/Openaijukebox/$original permanent; rewrite ^/Inktober/(?.*)$ https://old.reddit.com/r/Inktober/$original permanent; rewrite ^/Illustration/(?.*)$ https://old.reddit.com/r/Illustration/$original permanent; rewrite ^/logodesign/(?.*)$ https://old.reddit.com/r/logodesign/$original permanent; rewrite ^/(?.*/dp/B.*)$ https://amazon.com/$original permanent; # eg. '/Miracle-Philadelphia-Constitutional-Convention-September/dp/B0007ELQH0' rewrite ^/(?doc/www/.*)\.pdf%23(?[a-z0-9=]+)$ /$original.pdf\#$anchor permanent; rewrite ^/doc/www/(?.*)/\"$ https://$original permanent; # fix any hits to now-removed external link-bibliographies (long since obsoleted by 'fragment' popups, see /design-graveyard#popup-annotations): rewrite ^/(?.*)-link-bibliography /$original#link-bibliography permanent; rewrite ^/doc/link-bibliography/(?.*) /$original#link-bibliography permanent; # fix older annotations pre-interwiki-canonicalization: [a-z] → [A-Z]: (write out by hand because the recommended nginx way is to shell out to Lua in a separate block, and I don't want to mess with such complexity) rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fa(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FA$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fb(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FB$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fc(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FC$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fd(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FD$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fe(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FE$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Ff(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FF$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fg(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FG$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fh(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FH$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fi(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FI$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fj(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FJ$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fk(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FK$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fl(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FL$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fm(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FM$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fn(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FN$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fo(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FO$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fp(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FP$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fq(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FQ$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fr(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FR$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fs(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FS$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Ft(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FT$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fu(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FU$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fv(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FV$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fw(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FW$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fx(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FX$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fy(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FY$suffix permanent; rewrite ^/metadata/annotations/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2Fz(?.*)$ /metadata/annotation/https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FZ$suffix permanent; # post-WP popup shift to fully-dynamic: rewrite ^/image/thumbnails/wikipedia/[0-9][0-9][0-9]px-(?.*) https://en.wikipedia.org/wiki/File:$original permanent; rewrite ^/image/thumbnails/wikipedia/(?.*) https://en.wikipedia.org/wiki/File:$original permanent; rewrite ^/metadata/annotations/https%253A%252F%252Fen.wikipedia.org%252Fwiki%252F(?.*)\.html$ https://en.wikipedia.org/wiki/$original permanent; rewrite ^/(?(Category:|Special:|Skin/|Portal:|Talk:|Template_talk:|User:|User_talk:|Wikipedia:).*)$ https://en.wikipedia.org/wiki/$original permanent; rewrite ^/pmwiki/pmwiki.php/(?.*)$ https://tvtropes.org/pmwiki/pmwiki.php/$original permanent; rewrite ^/(?doc/.*).Pdf /$original.pdf permanent; rewrite ^/(?.*)\&source=gmail /$original permanent; rewrite ^/(?emociones/.*) https://competicionmental.appspot.com/$original permanent; rewrite ^/(?sound/[a-z]+\.mp3) https://competicionmental.appspot.com/$original permanent; rewrite ^/(?letrasImg/.*.png) https://competicionmental.appspot.com/$original permanent; rewrite ^/(?letra/.*) https://competicionmental.appspot.com/$original permanent; rewrite ^/(?/figuras/.*.png) https://competicionmental.appspot.com/$original permanent; rewrite ^/(?.*)\&rut\=.* /$original permanent; rewrite ^/(?.*)\&lang\=.* /$original permanent; rewrite ^/(?.*)\&keyword\=.* /$original permanent; rewrite ^/(?doc/.*/)\".* /$original/index permanent; rewrite ^/backlinks/(?.*) /metadata/annotations/backlink/$original permanent; rewrite ^/(?.*)\'.*(?.*)$ /$original1-$original2 permanent; # ' → - rewrite ^/(?.*)\&\;.*$ /$original permanent; rewrite ^/(?doc/.*/.*\.pdf)-.*$ /$original permanent; # deal with all the erroneous PDF links like '/doc/iq/2018-warne.pdf-en-espanol' rewrite ^/(?doc/.*/.*\.pdf)[A-Z][a-z]+$ /$original permanent; # '/doc/psychology/writing/1993-ericsson.pdfEriksson' rewrite ^/(?\.page)/.*$ /$original permanent; # '/foo.page/', surprisingly common rewrite ^/(?\.md)/.*$ /$original permanent; rewrite ^/(?.*)\&tbnid.*$ /$original permanent; rewrite ^/(?.*)\]$ /$original permanent; rewrite ^/(?.*)\[$ /$original permanent; rewrite ^/\.\/(?.*) /$original permanent; rewrite ^/(?.*).PAGE$ /$original.md permanent; rewrite ^/(?.*)\’ /$original permanent; rewrite ^/(?.*)\&title.*$ /$original permanent; rewrite ^/(?.*).pagee$ /$original.md permanent; rewrite ^/(?.*/)url$ /$original permanent; rewrite ^/(?doc/.*\.pdf)/.*$ /$original permanent; rewrite ^/(?tags/.*).page.*$ /$original permanent; rewrite ^/(?.*).pages$ /$original.md permanent; rewrite ^/(?.*).Page$ /$original.md permanent; rewrite ^/(?.*)adminer\..*$ /$original permanent; rewrite ^/(?doc/.*\.pd)\/(?f).*$ /$original$ext permanent; rewrite ^/(?doc/.*\.pd)%5c(?f).*$ /$original$ext permanent; rewrite ^/(?doc/.*\.)-pdf$ /$original.pdf permanent; rewrite ^/(?doc/.*\.pdf)y$ /$original permanent; rewrite ^/(?doc/.*\.pdf)y$ /$original permanent; rewrite ^/(?.*);.*$ /$original permanent; rewrite ^/(?pubmed/.*)$ https://www.ncbi.nlm.nih.gov/$original permanent; rewrite ^/(?pmc/articles/.*)$ https://www.ncbi.nlm.nih.gov/$original permanent; rewrite ^/(?.*)”$ /$original permanent; rewrite ^/(?.*\.html)[0-46-9]+$ /$original permanent; rewrite ^/(?.*/index)/index.html /$original permanent; rewrite ^/doc/pyschology/(?.*)$ /doc/psychology/$original permanent; rewrite ^/(?static/font/.*.ttf).*-format.*$ /$original permanent; rewrite ^/(?doc/.*)/inde$ /$original/index permanent; rewrite ^/(?.*[a-z])(?fn[0-9]+)$ /$original\#$originalAnchor permanent; rewrite ^/(?.*[a-z])(?fnref[0-9]+)$ /$original\#$originalAnchor permanent; rewrite ^/(?.*[a-z])(?sn[0-9]+)$ /$original\#$originalAnchor permanent; rewrite ^/(?.*)/[0-9]+px-.*em.*$ /$original permanent; rewrite ^/image/(?201[2-5]-[01][1-9]-[1-3][0-9]-tumblr_[mn][a-z0-9_]+_640\.png).*$ /image/hardtruthsfromsoftcats.tumblr.com/$original; rewrite ^/(?doc/.*)\]\(http.*$ /$original permanent; rewrite ^/metadata/annotations/similar/(?.*)$ /metadata/annotation/similar/$original permanent; rewrite ^/doc/psycology/(?.*)$ /doc/psychology/$original permanent; rewrite ^/doc/www/pkhungurn\.github\.io/data/videos/(?.*)$ https://pkhungurn.github.io/data/videos/$original permanent; rewrite ^/doc/www/semianalysis.com/(?.*)$ /doc/www/www.semianalysis.com/$original permanent; rewrite ^/(?doc/.*),pdf$ /$original.pdf permanent; rewrite ^/(?.*)%C3%A7$ /$original permanent; rewrite ^/(?.*)/index/index$ /$original/index permanent; rewrite ^/ttps://www\.gwern\.net/(?.*)$ /$original permanent; rewrite ^/doc/silk-road/(?.*)$ /doc/darknet-markets/$old permanent; rewrite ^/doc/ai/stylegan/(?.*)$ /doc/ai/gan/stylegan/$old permanent; rewrite ^/doc/ai/rnn/(?.*)$ /doc/ai/nn/rnn/$old permanent; rewrite ^/doc/ai/fully-connected/(?.*)$ /doc/ai/nn/fully-connected/$old permanent; rewrite ^/doc/ai/gpt/(?.*)$ /doc/ai/nn/transformer/gpt/$old permanent; rewrite ^/doc/ai/gan/(?.*)$ /doc/ai/nn/gan/$old permanent; rewrite ^/doc/reinforcement-learning/alphago/(?.*)$ /doc/reinforcement-learning/model/alphago/$old permanent; rewrite ^/doc/reinforcement-learning/muzero/(?.*)$ /doc/reinforcement-learning/model/muzero/$old permanent; rewrite ^/doc/reinforcement-learning/oa5/(?.*)$ /doc/reinforcement-learning/model-free/oa5/$old permanent; rewrite ^/doc/reinforcement-learning/alphastar/(?.*)$ /doc/reinforcement-learning/model-free/alphastar/$old permanent; rewrite ^/doc/eva/(?.*)$ /doc/anime/eva/$old permanent; rewrite ^/doc/conscientiousness/(?.*)$ /doc/psychology/personality/conscientiousness/$old permanent; rewrite ^/doc/spaced-repetition/(?.*)$ /doc/psychology/spaced-repetition/$old permanent; rewrite ^/doc/psychology/bird/(?.*)$ /doc/psychology/animal/bird/$old permanent; rewrite ^/doc/prediction/(?.*)$ /doc/statistics/prediction/$old permanent; rewrite ^/doc/terrorism/(?.*)$ /doc/crime/terrorism/$old permanent; rewrite ^/doc/statistics/crime/terrorism/(?.*)$ /doc/crime/terrorism/$old permanent; rewrite ^/doc/genetics/selection/dysgenics/(?.*)$ /doc/genetics/selection/natural/human/dysgenics/$old permanent; rewrite ^/doc/genetics/selection/index-selection/(?.*)$ /doc/genetics/selection/artificial/index-selection/$old permanent; rewrite ^/doc/genetics/selection/apple/(?.*)$ /doc/genetics/selection/artificial/apple/$old permanent; rewrite ^/doc/genetics/correlation/(?.*)$ /doc/genetics/heritable/correlation/$old permanent; rewrite ^/doc/linkrot/(?.*)$ /doc/cs/linkrot/$old permanent; rewrite ^/doc/advertising/(?.*)$ /doc/economics/advertising/$old permanent; rewrite ^/xf/BL_Image/(?.*)$ https://www.bluelight.org/xf/BL_Image/$original permanent; rewrite ^/doc/sf/(?.*)$ /doc/fiction/science-fiction/$old permanent; rewrite ^/doc/ai/alphafold/(?.*)$ /doc/ai/nn/transformer/alphafold/$old permanent; rewrite ^/doc/lithium/(?.*)$ /doc/psychiatry/lithium/$old permanent; rewrite ^/(?.*)/%E2%80%8B(?.*)$ /$before/$after permanent; rewrite ^/doc/iq/smpy/(?.*)$ /doc/iq/high/smpy/$old permanent; rewrite ^/doc/iq/anne-roe/(?.*)$ /doc/iq/high/anne-roe/$old permanent; rewrite ^/doc/iq/fullerton/(?.*)$ /doc/iq/high/fullerton/$old permanent; rewrite ^/doc/iq/munich/(?.*)$ /doc/iq/high/munich/$old permanent; rewrite ^/doc/longevity/john-bjorksten/(?.*)$ /doc/longevity/johan-bjorksten/$old permanent; rewrite ^/doc/ai/clip/samples/(?.*)$ /doc/ai/nn/transformer/clip/sample/$old permanent; rewrite ^/doc/ai/nn/transformer/clip/samples/(?.*)$ /doc/ai/nn/transformer/clip/sample/$old permanent; rewrite ^/doc/ai/clip/(?.*)$ /doc/ai/nn/transformer/clip/$old permanent; rewrite ^/doc/ai/sparsity/(?.*)$ /doc/ai/nn/sparsity/$old permanent; rewrite ^/doc/ai/retrieval/(?.*)$ /doc/ai/nn/retrieval/$old permanent; rewrite ^/doc/ai/adversarial/(?.*)$ /doc/ai/nn/adversarial/$old permanent; rewrite ^/doc/ai/diffusion/(?.*)$ /doc/ai/nn/diffusion/$old permanent; rewrite ^/image/ai/diffusion/(?.*)$ /image/ai/nn/diffusion/$old permanent; rewrite ^/doc/japanese/(?.*)$ /doc/japan/$old permanent; rewrite ^/doc/japan/zeami/(?.*)$ /doc/japan/poetry/zeami/$old permanent; rewrite ^/doc/music-distraction/(?.*)$ /doc/psychology/music/distraction/$old permanent; rewrite ^/doc/nature/(?.*)$ /doc/psychology/nature/$old permanent; rewrite ^/doc/humor/(?.*)$ /doc/fiction/humor/$old permanent; rewrite ^/doc/statistics/comparison/(?.*)$ /doc/statistics/order/comparison/$old permanent; rewrite ^/doc/sunk-cost/(?.*)$ /doc/psychology/cognitive-bias/sunk-cost/$old permanent; rewrite ^/doc/psychology/illusion-of-depth/(?.*)$ /doc/psychology/cognitive-bias/illusion-of-depth/$old permanent; rewrite ^/doc/ai/scaling/moe/(?.*)$ /doc/ai/scaling/mixture-of-experts/$old permanent; rewrite ^/(?doc/.*)/[0-9]$ /$original permanent; rewrite ^/(?doc/.*)/[0-9][0-9]$ /$original permanent; rewrite ^/(?doc/.*)/[0-9][0-9][0-9]$ /$original permanent; rewrite ^/(?doc/.*)/[0-9][0-9][0-9][0-9]$ /$original permanent; rewrite ^/(?.*)%E2%80%93(?.*)$ /$first-$second permanent; rewrite ^/\.\/(?.*)$ /$all permanent; rewrite ^/Doc/(?.*)$ /doc/$old permanent; rewrite ^/Doc/History/(?.*)$ /doc/history/$old permanent; rewrite ^/doc/cat/tartarian-honeysuckle/(?.*)$ /doc/cat/tatarian-honeysuckle/$old permanent; rewrite ^/(?.*)/null$ /$old/index permanent; rewrite ^/(?doc/.*)/null.*$ /$old/index permanent; rewrite ^/(?.*)%EF%BC%8E.*$ /$old permanent; rewrite ^/image/otakutalk/(?.*)$ /image/eva/otaku-talk/$old permanent; rewrite ^/image/storyofyourlife/(?.*)$ /image/story-of-your-life/$old permanent; rewrite ^/image/notenkimemoirs/blueblazes/(?.*)$ /image/notenki-memoirs/blue-blazes/$old permanent; rewrite ^/image/notenkimemoirs/(?.*)$ /image/notenki-memoirs/$old permanent; rewrite ^/image/spacedrepetition/(?.*)$ /image/spaced-repetition/$old permanent; rewrite ^/image/dnb/(?.*)$ /image/dual-n-back/$old permanent; rewrite ^/image/philo/(?.*)$ /image/philosophy/$old permanent; rewrite ^/image/ab/(?.*)$ /image/ab-testing/$old permanent; rewrite ^/image/coinflip/(?.*)$ /image/coin-flip/$old permanent; rewrite ^/image/silkroad/(?.*)$ /image/silk-road/$old permanent; rewrite ^/image/littleboy/(?.*)$ /image/eva/little-boy/$old permanent; rewrite ^/image/ai/dalle/2/(?.*)$ /image/ai/dall-e/2/$old permanent; rewrite ^/image/ai/dalle/1/(?.*)$ /image/ai/dall-e/1/$old permanent; rewrite ^/image/ai/dalle/(?.*)$ /image/ai/dall-e/$old permanent; rewrite ^/image/orderstatistics/(?.*)$ /image/statistics/order/$old permanent; rewrite ^/image/order-statistics/(?.*)$ /image/statistics/order/$old permanent; rewrite ^/image/dinosaurcomics/(?.*)$ /image/humor/dinosaur-comics/$old permanent; rewrite ^/image/lwsurvey/(?.*)$ /image/lw-survey/$old permanent; rewrite ^/image/rl/(?.*)$ /image/reinforcement-learning/$old permanent; rewrite ^/static/static/(?.*)$ /static/$old permanent; rewrite /doc/(?[a-z0-9-]+)/doc/(?.*)$ /doc/$first/$second permanent; rewrite /doc/(?[a-z0-9-]+/[a-z0-9-]+)/doc/(?[a-z0-9-].*)$ /doc/$first/$second permanent; rewrite /doc/(?[a-z0-9-]+/[a-z0-9-]+)/doc/.*/doc/(?[a-z0-9-].*)$ /doc/$first/$second permanent; # rewrite repeated-substitution errors like /doc/economics/advertising/doc/economics/advertising/doc/economics/advertising.../2021-freeman.pdf rewrite ^/(?.*)%21W$ /$old permanent; rewrite ^/(?.*)%3C/p$ /$old permanent; rewrite ^/(?.*)%23(?.*)$ /$prefix permanent; # strip 'foo.pdf#bar' encoded into the URL rewrite ^/(?.*)\".*$ /$prefix permanent; rewrite ^/(?.*)\&embed.*$ /$prefix permanent; rewrite ^/(?.*)\&target.*$ /$prefix permanent; rewrite ^/(?.*)\?nig.*$ /$prefix permanent; rewrite ^/(?.*)\?sourc.*$ /$prefix permanent; rewrite ^/(?.*)\?backlinkTarget.*$ /$prefix permanent; rewrite ^/(?.*)-https:.*$ /$prefix permanent; rewrite ^/(?.*)-http:.*$ /$prefix permanent; rewrite ^/(?.*)https:.*$ /$prefix permanent; rewrite ^/(?.*)http:.*$ /$prefix permanent; rewrite ^/(?.*)accessed.*$ /$prefix permanent; rewrite ^/tags/(?.*)+(?.*)$ /$first%20$second permanent; rewrite ^/newslettter/(?.*)$ /newsletter/$old permanent; rewrite ^/newsleter/(?.*)$ /newsletter/$old permanent; rewrite ^/(?20[0-5][0-9]/[01][0-9]$ /newsletter/$issue permanent; rewrite ^/(?.*)`(?.*)$ /$old$old2 permanent; rewrite ^/(?.*)\.page/index\.html$ /$old.md permanent; rewrite ^/(?.*)\.page/$ /$old.md permanent; rewrite ^/(?.*)\.page\.html$ /$old.md.html permanent; rewrite ^/(?.*)/N/A$ /$old permanent; rewrite ^/(?.*)‐(?.*)$ /$first-$second permanent; # convert HYPHEN (which is bad!) to what everyone thinks HYPHEN is, HYPHEN-MINUS rewrite ^/(?.*)\+(?.*)$ /$first-$second permanent; rewrite ^/tatic/(?.*)$ /static/$old permanent; rewrite ^/doc/anime/eva/anime/eva/(?.*)$ /doc/anime/eva/$old permanent; rewrite ^/(?.*)/index/wp$ /$old/index permanent; rewrite ^/doc/(?.*)/docs?/(?.*)$ /doc/$dir/$file permanent; rewrite ^/pmc/(?.*)$ https://www.ncbi.nlm.nih.gov/pmc/$old permanent; # rewrite LW links like `/posts/5yFRd3cjLpm3Nd6Di/argument-screens-off-authority` (17 character ID): rewrite ^(?/posts/[A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9]/[a-z-]+$) https://lesswrong.com$old permanent; rewrite ^/(?.*)-530px.jpg-530px.jpg$ /$old permanent; rewrite ^/(?.*)-530px.jpg$ /$old permanent; rewrite ^/(?.*)-768px\.[jp][pn]g$ /$old permanent; rewrite ^/image/(?.*)$ /doc/$old permanent; rewrite ^/genetics/(?.*)$ /doc/genetics/$old permanent; rewrite ^/doc/gan/stylegan/(?.*)$ /doc/ai/nn/gan/stylegan/$old permanent; rewrite ^/(?.*),.*$ /$old permanent; rewrite ^/Docs?/(?.*)$ /doc/$old permanent; rewrite ^/\.\/(?.*)$ /$old permanent; # eg. '/./Complement' rewrite ^/(?.*)@(?.*)$ /$page#$anchor permanent; # eg. '/review/movie@all-about-eve' - for some reason, '#' fragments often get translated to '@'. Haven't figured out who or why. rewrite ^/(?doc/psychology/okcupid/.*\.html).+$ /$page permanent; # the ingenuity of people coming up with new typos on OKC archives is astounding rewrite ^/(?doc/psychology/.*)\.htm$ /$page.html permanent; rewrite ^/(?.*\.pdf)(Just|this|it|there|as|you|me|if|on|special|the|in|link|they|og|2|also|for|3|\.html|abstractlike|sorry|please|replydelete|[Hh]e|[Ss]he|Nebula|Social|Since)$ /$old permanent; rewrite ^/(?static/build/.*)\.hi$ /$hs.hs permanent; rewrite ^/(?static/build/.*)\.o$ /$hs.hs permanent; rewrite ^/(?.*)%E2%80%93(?.*)$ /$first-$second permanent; rewrite ^/.*ttps\:\/\/gwern\.net/(?.*) /$original permanent; rewrite ^/doc/cryonic/(?.*)$ /doc/cryonics/$original permanent; rewrite ^/doc/philosophy/frank-p-ramsey/(?.*)$ /doc/philosophy/frank-ramsey/$original permanent; rewrite ^/(?doc/.*)/3[Dd]$ /$original/index permanent; rewrite ^/(?.*)\)$ /$original permanent; rewrite ^/(?.*)\[.*$ /$original permanent; rewrite ^/(?.*)\].*$ /$original permanent; rewrite ^/\./(?.*)$ /$original permanent; rewrite ^/\./(?.*)%7C4$ /$original permanent; rewrite ^/doc/psychology/european-journal-of-parapsychology/(?.*)$ /doc/psychology/parapsychology/european-journal-of-parapsychology/$original permanent; rewrite ^/doc/www/i.reddit.com/(?.*)$ /doc/www/old.reddit.com/$old permanent; rewrite ^/doc/reinforcement-learning/brain-imitation-learning/(?.*)$ /doc/reinforcement-learning/imitation-learning/brain-imitation-learning/$old permanent; rewrite ^/doc/www/(?.*)/.*\.html/favicon.ico$ https://$domain/favicon.ico permanent; # match domain+snapshot examples like `/doc/www/edwardtufte.github.io/e43d8239ed3fa1d513e2b4d071b6a7c0c8a98bff.html/favicon.ico` rewrite ^/doc/www/(?.+\..+)/favicon.ico$ https://$domain/favicon.ico permanent; # match domain examples like `/doc/www/languagelog.ldc.upenn.edu/favicon.ico` rewrite ^/(?.*)/wp-admin/css/.*$ /$original permanent; # fix en masse all of the doc-prefix-less file hosting errors that keep happening (not least by myself when carelessly linking people to documents), by rewriting for all top-level doc/foo/ paths to date: # NOTE: must be careful to skip top-level directories that do in fact exist (eg. 'zeo', 'nootropic', 'fiction') rewrite ^/ai/(?.*)$ /doc/ai/$original permanent; rewrite ^/algernon/(?.*)$ /doc/algernon/$original permanent; rewrite ^/anime/(?.*)$ /doc/anime/$original permanent; rewrite ^/biology/(?.*)$ /doc/biology/$original permanent; rewrite ^/bitcoin/(?.*)$ /doc/bitcoin/$original permanent; rewrite ^/borges/(?.*)$ /doc/borges/$original permanent; rewrite ^/cat/(?.*)$ /doc/cat/$original permanent; rewrite ^/co2/(?.*)$ /doc/co2/$original permanent; rewrite ^/creatine/(?.*)$ /doc/creatine/$original permanent; rewrite ^/crime/(?.*)$ /doc/crime/$original permanent; rewrite ^/cryonics/(?.*)$ /doc/cryonics/$original permanent; rewrite ^/cs/(?.*)$ /doc/cs/$original permanent; rewrite ^/culture/(?.*)$ /doc/culture/$original permanent; rewrite ^/darknet-market/(?.*)$ /doc/darknet-market/$original permanent; rewrite ^/dataset/(?.*)$ /doc/dataset/$original permanent; rewrite ^/design/(?.*)$ /doc/design/$original permanent; rewrite ^/dog/(?.*)$ /doc/dog/$original permanent; rewrite ^/dual-n-back/(?.*)$ /doc/dual-n-back/$original permanent; rewrite ^/economics/(?.*)$ /doc/economics/$original permanent; rewrite ^/exercise/(?.*)$ /doc/exercise/$original permanent; rewrite ^/existential-risk/(?.*)$ /doc/existential-risk/$original permanent; rewrite ^/food/(?.*)$ /doc/food/$original permanent; rewrite ^/genetics/(?.*)$ /doc/genetics/$original permanent; rewrite ^/gwern.net-gitstats/(?.*)$ /doc/gwern.net-gitstats/$original permanent; rewrite ^/history/(?.*)$ /doc/history/$original permanent; rewrite ^/insight-porn/(?.*)$ /doc/insight-porn/$original permanent; rewrite ^/interview/(?.*)$ /doc/interview/$original permanent; rewrite ^/iodine/(?.*)$ /doc/iodine/$original permanent; rewrite ^/iq/(?.*)$ /doc/iq/$original permanent; rewrite ^/japan/(?.*)$ /doc/japan/$original permanent; rewrite ^/law/(?.*)$ /doc/law/$original permanent; rewrite ^/lesswrong-survey/(?.*)$ /doc/lesswrong-survey/$original permanent; rewrite ^/longevity/(?.*)$ /doc/longevity/$original permanent; rewrite ^/long-now/(?.*)$ /doc/long-now/$original permanent; rewrite ^/marijuana/(?.*)$ /doc/marijuana/$original permanent; rewrite ^/math/(?.*)$ /doc/math/$original permanent; rewrite ^/melatonin/(?.*)$ /doc/melatonin/$original permanent; rewrite ^/meta/(?.*)$ /doc/meta/$original permanent; rewrite ^/modafinil/(?.*)$ /doc/modafinil/$original permanent; rewrite ^/music/(?.*)$ /doc/music/$original permanent; rewrite ^/newest/(?.*)$ /doc/newest/$original permanent; rewrite ^/nicotine/(?.*)$ /doc/nicotine/$original permanent; rewrite ^/personal/(?.*)$ /doc/personal/$original permanent; rewrite ^/philosophy/(?.*)$ /doc/philosophy/$original permanent; rewrite ^/politics/(?.*)$ /doc/politics/$original permanent; rewrite ^/psychedelic/(?.*)$ /doc/psychedelic/$original permanent; rewrite ^/psychiatry/(?.*)$ /doc/psychiatry/$original permanent; rewrite ^/psychology/(?.*)$ /doc/psychology/$original permanent; rewrite ^/radiance/(?.*)$ /doc/radiance/$original permanent; rewrite ^/reinforcement-learning/(?.*)$ /doc/reinforcement-learning/$original permanent; rewrite ^/rotten.com/(?.*)$ /doc/rotten.com/$original permanent; rewrite ^/science/(?.*)$ /doc/science/$original permanent; rewrite ^/sociology/(?.*)$ /doc/sociology/$original permanent; rewrite ^/statistics/(?.*)$ /doc/statistics/$original permanent; rewrite ^/survey/(?.*)$ /doc/survey/$original permanent; rewrite ^/tea/(?.*)$ /doc/tea/$original permanent; rewrite ^/technology/(?.*)$ /doc/technology/$original permanent; rewrite ^/touhou/(?.*)$ /doc/touhou/$original permanent; rewrite ^/traffic/(?.*)$ /doc/traffic/$original permanent; rewrite ^/transhumanism/(?.*)$ /doc/transhumanism/$original permanent; rewrite ^/tutorial/(?.*)$ /doc/tutorial/$original permanent; rewrite ^/vitamin-d/(?.*)$ /doc/vitamin-d/$original permanent; rewrite ^/wikipedia/(?.*)$ /doc/wikipedia/$original permanent; rewrite ^/wiki/(?.*)$ /$original permanent; rewrite ^/(?.*)\~$ /$original permanent; rewrite ^/(?.*)%7E$ /$original permanent; rewrite ^/home/gwern/wiki/(?.*)$ /$original permanent; rewrite ^/www/(?.*)$ /doc/www/$original permanent; rewrite ^/doc/www/nitter.moomoo.me/(?.*)$ /doc/www/nitter.net/$original permanent; rewrite ^/doc/www/nitter.net/(?.*)$ /doc/www/localhost/$original permanent; rewrite ^/doc/(?.*)/out.html$ /$original/index permanent; rewrite ^/doc/misc/(?.*)$ /doc/www/misc/$original permanent; rewrite ^/misc/(?.*)$ /doc/www/misc/$original permanent; rewrite ^/[a-z0-9-]+/[a-z0-9-]+/doc/(?.*)$ /doc/$original permanent; rewrite ^/[a-z0-9-]+/[a-z0-9-]+/[a-z0-9-]+/doc/(?.*)$ /doc/$original permanent; rewrite ^/[a-z0-9-]+/doc/(?.*)$ /doc/$original permanent; rewrite ^/doc/longevity/johan-bjorksten/index/longevity/johan-bjorksten/(?.*)$ /doc/longevity/johan-bjorksten/$original permanent; rewrite ^/doc/iq/high/smpy/index/iq/high/smpy/(?.*)$ /doc/iq/high/smpy/$original permanent; rewrite ^/doc/genetics/heritable/correlation/genetics/heritable/correlation/(?.*)$ /doc/genetics/heritable/correlation/$original permanent; rewrite ^/doc/economics/advertising/economics/advertising/(?.*)$ /doc/economics/advertising/$original permanent; rewrite ^/doc/design/typography/tex/index/design/typography/tex/(?.*)$ doc/design/typography/tex/$original permanent; rewrite ^/doc/biology/index/(?.*)$ /doc/biology/$original permanent; rewrite ^/doc/anime/eva/little-boy/index/anime/eva/little-boy/(?.*)$ /doc/anime/eva/little-boy/$original permanent; rewrite ^/doc/anime/eva/index/anime/eva/(?.*)$ /doc/anime/eva/$original permanent; rewrite ^/doc/ai/nn/rnn/index/ai/nn/rnn/(?.*)$ /doc/ai/nn/rnn/$original permanent; rewrite ^/_src(?.*)$ /static/$original permanent; rewrite ^/doc/ai/.*/arxiv.org/(?.*)$ /doc/www/arxiv.org/$original permanent; rewrite ^/doc/statistics/bias/animal/index/(?.*)$ /doc/$original permanent; rewrite ^/doc/longevity/semaglutide/(?.*)$ /doc/longevity/glp/semaglutide/$file permanent; rewrite ^/doc/longevity/tirzepatide/(?.*)$ /doc/longevity/glp/tirzepatide/$file permanent; rewrite ^/(?[L-Nl-n]*[h-q][r-t][s-v].[j-m][A-Ca-f][m-z]).*$ /$original permanent; rewrite ^/(?.*).shtml$ /$original.html permanent; rewrite ^/(?.*)[\:\;\,]$ /$original permanent; rewrite ^/(?.*)/1000$ /$original permanent; rewrite ^/static/font/drop-cap/(?.*)$ /static/font/dropcap/$original permanent; rewrite ^/metadata/annotation/(?.*)/\%\2\f(?.*)$ /metadata/annotation/$base/$2F$original permanent; rewrite /protein/(?.*)$ https://www.ncbi.nlm.nih.gov/protein/$protein permanent; rewrite /doc/[a-z]+/www/(?.*\..*/[a-z0-9]+\.html)$ /doc/www/$mirror permanent; rewrite /(?.*)/index\.xml$ /$original/index permanent; rewrite /(?.*)/div$ /$original/index permanent; rewrite /h?t?t?p?s?:\/\/w?w?w?\.?gwern\.net\/(?.*)$ /$original permanent; rewrite /doc/genetics/selection/artificial/apple/genetics/selection/.*/(?.*.pdf)$ /doc/genetics/selection/artificial/apple/$original permanent; rewrite ^/doc/psychology/inner-monologue/(?.*)$ /doc/psychology/inner-voice/$old permanent; rewrite ^/doc/www/scribe\.rip/(?.*)$ /doc/www/freedium.cfd/$old permanent; rewrite ^/(?.*)~$ /$old permanent; rewrite ^/(?.*)\&$ /$old permanent; rewrite ^/(?.*)/guestbook$ /$old/index permanent; rewrite ^/doc/music/music-distraction/(?.*)$ /doc/psychology/music/distraction/$old permanent; rewrite ^/(?.*)/1\*(?.*)$ /$before/$after permanent; rewrite ^/(?.*)\*(?.*)$ /$before$after permanent; rewrite ^/doc/www/.*\.madasafish.com/artwork/(?.*)$ http://members.madasafish.com/artwork/$after permanent; rewrite ^/doc/www/members.madasafish.com/Location_Location/(?.*)$ http://members.madasafish.com/Location_Location/$after permanent; rewrite ^/doc/www/members.madasafish.com/map_of-Hogwarts/(?.*)$ http://members.madasafish.com/map_of-Hogwarts/$after permanent; rewrite ^/metadata/annotations/doc/(?[0-9a-zA-Z].*) /metadata/annotation/%2Fdoc/$original permanent; rewrite ^/metadata/annotations/(?[0-9a-ce-gi-z].*) /metadata/annotation/%2F$original permanent; rewrite ^//(?.+)$ /$original permanent; rewrite ^/(?[A-Za-z0-9-]+)/$ /$original permanent; # try to deal with the spiders bruteforcing appending '/' to all essays like '/self-decrypting/' # rewrite ^/(?[A-Za-z0-9-]+/[a-z0-9-]+)/$ /$original permanent; # BAD creates loops! # Gitit dot-page → Markdown .md migration: rewrite /(?.*)\.page$ /$original.md permanent; ## it's very hard to fix broken '#' anchors since it's client-side, the web server isn't support to see it ## and I couldn't find any Nginx solution I understood, so we just strip the trailing garbage: rewrite ^(?.*)\#(?.*) $u permanent; ## Strip all query-parameters which are meaningless on Gwern.net & only yield 404s ## NOTE: '$args' = '?args' in 'foo.com/bar?args' set $args ''; ## when browsing files like `/doc/foo/2024-bar.pdf`, any experienced web user might try to browse by going to the index `/doc/foo/index.html`, but we actually put them at `/doc/foo/index`; instead of trying to create thousands of redirects for every possible error, we tell nginx to check for the /index file existing and if it does, load that instead try_files $uri $uri/ @fallback; } # backslashed URL requests like 'https://gwern.net/dnb-faq%5C' are always broken, but also very hard to match normally, for some reason, and so result in a huge number of spurious errors. Try to catch them all here. # (Why are there so many? My guess is this is downstream of bad code, where the authors failed to correctly escape the escaping characters and so wind up spamming backslashes everywhere.) # NOTE: the triple-backslash is not an error. That is in fact how you match a single '\' literal, due to Lua being involved: . This is hard to find out because '\\' and '\' and '\\\\' all just fail silently or cause subtle bugs. if ($uri ~ "^(?.*?)\\\$") { return 301 $scheme://$host$original; } # if ($request_uri ~ "^(?.*?)[\\%5C]+$") { # return 301 $scheme://$host$original; # } # Enable redirection? TODO: I don't understand why this seems to be necessary in addition to `map` if ($new_uri != "" ) { rewrite ^(.*)$ $new_uri permanent; } location @fallback { # Handle the specific fallback for missing index.html or index.htm rewrite ^(/.+)/index\.html?$ $1/index permanent; } }