How to serve static files on different url

By default, Hugo serves static files relative to the root. For example; currently the static files for images are available in /images/.... but I’d like them to be available at /<namespace>/images/

Basically I’m using Hugo in conjunction with another site and the Hugo site lives exclusively at /knowledge-center. I got everything else working through various hacks except the static assets do not serve at /knowledge-center/ but serve at /

One solution may be to change the baseURL to /<website-url>/knowledge-center however; I use a different website URL for dev vs staging vs production. How to render this dynamically in toml? That does not seem like an optimal solution.

How do I go about this? Thank you very much!

Set baseURL in the config to the production value:

https://www.example.org/knowledge-center/

Then in dev and staging add --baseUrl=https://www.example.test/ to the hugo command.