I have the following html/
directory and a Caddyfile:
Caddyfile
html/
├── 404.html
├── 500.html
├── about.html
├── blog
│ ├── one.html
│ ├── two.html
│ └── three.html
├── blog.html
├── home.html
├── projects.html
└── static
├── css
│ └── site.css
├── images
│ ├── favicon.ico
└── js
└── highlight.pack.js
I'd like requests to resolve in the following way:
localhost:8080/
orlocalhost:8080
-> serveshtml/home.html
localhost:8080/about
-> serveshtml/about.html
localhost:8080/about/
-> serveshtml/about.html
-> rewrites URI to/about
localhost:8080/about.html
-> serveshtml/about.html
-> rewrites URI to/about
localhost:8080/blog/one
-> serves `html/blog/one.html- 404 and 500 errors serve
html/404.html
andhtml/500.html
respectively
I feel like I have it almost right but the combination of uri
and try_files
is not producing the exact effect as described above:
http://localhost:8080
uri strip_suffix .html
try_files {path}.html
handle_errors {
rewrite * html/{err.status_code}.html
file_server
}
file_server {
index home.html
root html
}
Do the requests for .html
extension URIs have to be redirected somehow to their non-.html
equivalents?