Skip to content

Next.js 14 App Router Implementation: Can I get cleaner urls? #6267

Answered by Haroenv
dante-blitz asked this question in Q&A
Discussion options

You must be logged in to vote

You can use the option encode: false for qs by using the qsModule key of createURL in routing. See more info here: https://github.com/ljharb/qs?tab=readme-ov-file#stringifying and the default createURL function you can modify to pass that option:

createURL = ({ qsModule, routeState, location }) => {
const { protocol, hostname, port = '', pathname, hash } = location;
const queryString = qsModule.stringify(routeState);
const portWithPrefix = port === '' ? '' : `:${port}`;
// IE <= 11 has no proper `location.origin` so we cannot rely on it.
if (!queryString) {

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@dante-blitz
Comment options

Answer selected by dante-blitz
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants