Redirecting development server to the default path from the baseurl

My config.toml has: baseurl = “

When I start the development server with “hugo server -D” and visit “http://localhost:1313/”, I see an error page with “404 page not found”.

Instead of showing an error, it would be great if the hugo development server would redirect me to the default path from the baseurl, which is “/blog”.

Is it possible to configure this behavior?

Currently, no. But you get the correct URL in the log:

Web Server is available at http://localhost:1313/hugotest/

(just tested with a site I have).

What you want would be possible, I guess, but I’m not sure it’s worth the effort.

Ok, thanks for letting me know! It’s not a big issue because hugo server prints out Web Server is available at http://localhost:1313/blog/ in the console, so I can just click to open it in the browser. But occasionally I’ll type “localhost:1313” in the browser and forget to add “/blog” to the end. I think it would be a sane default to redirect to that path instead of showing a 404 page. Especially if there’s no way to configure the root path.

I’d be happy to submit a PR if you think that might be accepted? It should only be a small change, so I’d love to contribute back to hugo and make the UX a tiny bit better.


I will merge it is a relatively small change.

Late to the party… beginner question form my side: in every tutorial/manual I see http://localhost:1313 after the local server start - and this works indeed for a site created from scratch.

But after I have added a template, the URL is given with the template name as path suffix. (e.g. http://localhost:1313/logbook).
I just want to understand the reason for the URL change. Any hints?

Ok… found it out: the path HUGO serves the page on locally comes from the baseURL in the config.
In my case it was set to
baseURL = ""
If I change this for testing to
baseURL = ""
the page gets served on http://localhost:1313/foo

=> As soon as you provide a baseURL without a path, the page gets served locally without a path, too.