On 2021-02-27 00:38, Bruce Hill wrote: > Hello, this is my first time contributing to openbsd and this mailing > list, so please excuse any newbie blunders. I recently switched my > personal website to use httpd with statically generated HTML files, but > was unhappy to find that my HTML files could only be accessed by exact > filename, including the ".html" at the end. My site previously ran on > Apache with rewrite rules to ensure that "example.com/foo" would serve > the file "/foo.html" (when "/foo" didn't exist). I wanted to keep my > original URLs working and I aesthetically prefer URLs without ".html" > suffixes, so I looked around for different options with httpd. The best > option I could find was to create symbolic links from "/foo" to > "/foo.html" and set the default media type to text/html, but this > solution was cumbersome (I had to maintain all the symbolic links) and > had undesirable side effects (all extensionless files were treated as > text/html instead of text/plain). >
Hello, wouldn't the following serve for what you want? location not found match "^/scripts/(.*)$" { request rewrite "/scripts/%1.php" } location not found match "^/(.*)$" { request rewrite "/%1.html" }