Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol. wisp.place
at redirects 3.9 kB view raw
1# Example _redirects file for Wisp hosting 2# Place this file in the root directory of your site as "_redirects" 3# Lines starting with # are comments 4 5# =================================== 6# SIMPLE REDIRECTS 7# =================================== 8 9# Redirect home page 10# /home / 11 12# Redirect old URLs to new ones 13# /old-blog /blog 14# /about-us /about 15 16# =================================== 17# SPLAT REDIRECTS (WILDCARDS) 18# =================================== 19 20# Redirect entire directories 21# /news/* /blog/:splat 22# /old-site/* /new-site/:splat 23 24# =================================== 25# PLACEHOLDER REDIRECTS 26# =================================== 27 28# Restructure blog URLs 29# /blog/:year/:month/:day/:slug /posts/:year-:month-:day/:slug 30 31# Capture multiple parameters 32# /products/:category/:id /shop/:category/item/:id 33 34# =================================== 35# STATUS CODES 36# =================================== 37 38# Permanent redirect (301) - default if not specified 39# /permanent-move /new-location 301 40 41# Temporary redirect (302) 42# /temp-redirect /temp-location 302 43 44# Rewrite (200) - serves different content, URL stays the same 45# /api/* /functions/:splat 200 46 47# Custom 404 page 48# /shop/* /shop-closed.html 404 49 50# =================================== 51# FORCE REDIRECTS 52# =================================== 53 54# Force redirect even if file exists (note the ! after status code) 55# /override-file /other-file.html 200! 56 57# =================================== 58# CONDITIONAL REDIRECTS 59# =================================== 60 61# Country-based redirects (ISO 3166-1 alpha-2 codes) 62# / /us/ 302 Country=us 63# / /uk/ 302 Country=gb 64# / /anz/ 302 Country=au,nz 65 66# Language-based redirects 67# /products /en/products 301 Language=en 68# /products /de/products 301 Language=de 69# /products /fr/products 301 Language=fr 70 71# Cookie-based redirects (checks if cookie exists) 72# /* /legacy/:splat 200 Cookie=is_legacy 73 74# =================================== 75# QUERY PARAMETERS 76# =================================== 77 78# Match specific query parameters 79# /store id=:id /blog/:id 301 80 81# Multiple parameters 82# /search q=:query category=:cat /find/:cat/:query 301 83 84# =================================== 85# DOMAIN-LEVEL REDIRECTS 86# =================================== 87 88# Redirect to different domain (must include protocol) 89# /external https://example.com/path 90 91# Redirect entire subdomain 92# http://blog.example.com/* https://example.com/blog/:splat 301! 93# https://blog.example.com/* https://example.com/blog/:splat 301! 94 95# =================================== 96# COMMON PATTERNS 97# =================================== 98 99# Remove .html extensions 100# /page.html /page 101 102# Add trailing slash 103# /about /about/ 104 105# Single-page app fallback (serve index.html for all paths) 106# /* /index.html 200 107 108# API proxy 109# /api/* https://api.example.com/:splat 200 110 111# =================================== 112# CUSTOM ERROR PAGES 113# =================================== 114 115# Language-specific 404 pages 116# /en/* /en/404.html 404 117# /de/* /de/404.html 404 118 119# Section-specific 404 pages 120# /shop/* /shop/not-found.html 404 121# /blog/* /blog/404.html 404 122 123# =================================== 124# NOTES 125# =================================== 126# 127# - Rules are processed in order (first match wins) 128# - More specific rules should come before general ones 129# - Splats (*) can only be used at the end of a path 130# - Query parameters are automatically preserved for 200, 301, 302 131# - Trailing slashes are normalized (/ and no / are treated the same) 132# - Default status code is 301 if not specified 133# 134