#2184·leptos

Support hashstyle routing

Author: enscCreated Jan 13, 2024Updated Sep 14, 2026
Labelsfeature request

Is your feature request related to a problem? Please describe.

atm, laptos_router works only with the url path. E.g. when http://localhost/app/ serves

rust
    view! {
        <Router>
	    <a href="home">Home</a>
	    <Routes>
	    <Route path="home" view=|| { view! { Home } }/>
	    </Routes>
	    </Router>
    }

a click on "Home" will go to http://localhost/app/home.

This creates problems with passive hosting (e.g. as gitlab/github pages) because the url does not exist and you will get an 404 error when trying to open it directly.

You have to modify server configuration to make it work (RewriteEngine on). Even in this case, it complicates accessing relative resources because document.baseURI has changed and you will have to hardcode the application uri. It pollutes also the namespace and hides invalid URLs.

Describe the solution you'd like

It would be nice when routing is implemented as html anchors. E.g. the example above would go to http://localhost/app/#home

Implementing it manually as

rust
    view! {
        <Router>
	    <a href="#home">Home</a>
	    <Routes>
	    <Route path="#home" view=|| { view! { Home } }/>
	    </Routes>
	    </Router>
    }

does not work (laptos-router 0.5.4).

Additional context

see e.g. https://router.vuejs.org/guide/essentials/history-mode.html