Update browsers address bar with url_base_pathname when using dcc.link

Hi everybody,

i am using a dcc.link element to create links and navigate in a multi-page dashboard. I also use the url_base_pathname config as the dashboard is reachable via an url containing a path.
The links href look like “/some/page”, not containing the url base. Navigation works fine, under the hood the url_base_pathname is prepended to the link.

But in the address bar of the browser the url_base_pathname isn’t integrated, so the address bar is still host/some/page instead of host/base/path/some/page. And trying to access the host/some/page url fails.

One might argue that its only cosmetic, but knowing the users of the dashboard they will bookmark a link to specifc page, which will fail to open.

am i missing something to also update the url?

Hi @j4nu5 and welcome to the Dash community :slightly_smiling_face:

You can use dash.get_relative_path in your link:

If you are using Pages, that is handled for you. See example #2 here:


Thanks AnnMarie. I hoped that there would be a chance to do it without source code changes, but this will work as well. And I will urge to colleagues to use the native multi page support :slight_smile: