status.site.example {
	root * /home/USERNAME/status.site.example/public

	@slash {
		path_regexp slash /$
	}

	@jsonld {
		path_regexp jsonld \.jsonld$
	}

	@atom {
		path_regexp atom \.atom$
	}

	@bare {
		not path_regexp /$
		not path_regexp \.jsonld$
		not path_regexp \.atom$
	}

	@empty {
		expression {re.matcher.suffix} == ""
	}

	handle / {
		rewrite * /index.html
		header Link </about.jsonld>;rel=meta;type="application/ld+json"
		header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
	}

	@iri {
		path_regexp matcher ^/(?P<iri>[^/:]+:[^/]+)/?$
	}

	handle @iri {
		handle @bare {
			rewrite * /.lookup.xhtml
			header Cache-Control max-age=0
		}

		handle @slash {
			redir * /{re.matcher.iri}
		}
	}

	handle /about {
		rewrite * /.about.html
		header Link </about.jsonld>;rel=meta;type="application/ld+json"
		header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
	}

	redir /about/ /about

	rewrite /about.jsonld /about/index.jsonld

	handle /statuses {
		rewrite * /.statuses.html
		header Link </statuses.jsonld>;rel=meta;type="application/ld+json"
		header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
	}

	redir /statuses/ /statuses

	rewrite /statuses.jsonld /statuses/index.jsonld

	rewrite /statuses.atom /statuses/index.atom

	@dated {
		path_regexp matcher ^/statuses/(?P<ym>\d{4}-\d{2})(?P<suffix>/[^/.]+)?(?:\..*|/)?$
		not path_regexp ^/statuses/index[/.]?
	}

	handle @dated {
		handle @empty {
			handle @bare {
				rewrite * /.topic.html
				header Link </statuses/{re.matcher.ym}.jsonld>;rel=meta;type="application/ld+json"
				header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
			}

			handle @slash {
				redir * /statuses/{re.matcher.ym}
			}

			handle @jsonld {
				rewrite * /statuses/{re.matcher.ym}/index.jsonld
			}

			handle @atom {
				rewrite * /statuses/{re.matcher.ym}/index.atom
			}
		}

		handle {
			handle @bare {
				rewrite * /.status.html
				header Link </statuses/{re.matcher.ym}.jsonld>;rel=meta;type="application/ld+json"
				header Link </statuses.atom>;rel=alternate;type="application/atom+xml"
			}

			handle @slash {
				redir * /statuses/{re.matcher.ym}{re.matcher.suffix}
			}
		}
	}

	handle /topics {
		rewrite * /.topics.html
		header Link </topics.jsonld>;rel=meta;type="application/ld+json"
	}

	redir /topics/ /topics

	rewrite /topics.jsonld /topics/index.jsonld

	@topics {
		path_regexp matcher ^/topics/(?P<topic>[0-9A-Za-z_-]+)(?P<suffix>/[^/.]+)?(?:\..*|/)?$
		not path_regexp ^/topics/index[/.]?
	}

	handle @topics {
		handle @empty {
			handle @bare {
				rewrite * /.topic.html
				header Link </topics/{re.matcher.topic}.jsonld>;rel=meta;type="application/ld+json"
				header Link </topics/{re.matcher.topic}.atom>;rel=alternate;type="application/atom+xml"
			}

			handle @slash {
				redir * /topics/{re.matcher.topic}
			}

			handle @jsonld {
				rewrite * /topics/{re.matcher.topic}/index.jsonld
			}

			handle @atom {
				rewrite * /topics/{re.matcher.topic}/index.atom
			}
		}

		handle {
			handle @bare {
				rewrite * /.status.html
				header Link </topics/{re.matcher.topic}.jsonld>;rel=meta;type="application/ld+json"
				header Link </topics/{re.matcher.topic}.atom>;rel=alternate;type="application/atom+xml"
			}

			handle @slash {
				redir * /topics/{re.matcher.topic}{re.matcher.suffix}
			}
		}
	}

	header {
		Access-Control-Allow-Origin "*"
		?Cache-Control max-age=3600
	}

	file_server {
		index index.xml index.xhtml index.html index.rdf index.txt
	}
}