I need to switch from using prettyurls to uglyurls and was hoping to avoid broken links to the prettyurls by using aliases to retain them and redirect an uglyurl. I’ve been through the article below which suggests this works;
However it only appears to work when you don’t have uglyurls=true in the config.toml, if this is enabled it will only redirect “/2010/01/01/even-earlier-url.html” and “/posts/my-original-url/” throws a 404. Am I missing something or is this expected behaviour?
Thanks for the response. Unfortunately what you’ve suggested doesn’t work. If uglyurls=true is set then the aliases for prettyurls don’t work and you get a 404. In the suggestion you have given, “/2010/01/01/even-earlier-url.html” works, but "/2010/01/01/even-earlier-url/” does not.
However I now think this is expected behaviour. If my understanding of how hugo works is correct it first generates ugly URLs for the Aliases and content in .html format. It will then generate PrettyURLs from the ugly URLs. Therefore if prettyurls have been disabled by setting uglyurls=true then it will not create any prettyurls even if one is used in an alias.