Is it possible to redirect or rewrite every URL ending in /*.md to /*.html?

Is it possible to configure my site so that every URL accessed with a certain extension, for example https://example.com/path/file.md (which does not exist) is redirected to https://example.com/path/file.html ? How would I achieve this?

The reason I’d like to do this is for occasions when I’m browsing a GitHub PR and copy the path (/path/file.md) - it would be very convenient to be able to paste it into my address bar (in conjunction with a search shortcut) to view the associated live page.

I don’t think you can add a file extension specific redirect, but this post by @jonsully might be of use:

Can I strip .pdf extension in redirect rule? - #3 by jonsully

1 Like