How can I make a dynamic route start with an @ symbol? Like "mywebsite.com/@username
Unanswered
Acorn Woodpecker posted this in #help-forum
Acorn WoodpeckerOP
Hi, I was looking for a solution to "How can I make a dynamic route start with an @ symbol? Like mywebsite.com/@username" and came across an old question on GitHub where a user had responded.
https://github.com/vercel/next.js/discussions/31932
Rewrite config:
I wanted to know if, as of 2025 and version 15.4, this is still the only way to do it, or if there's now a better method?
https://github.com/vercel/next.js/discussions/31932
Rewrite config:
rewrites: async () => {
return [
{
source: "/@:username",
destination: "/user/:username",
},
];
},
I wanted to know if, as of 2025 and version 15.4, this is still the only way to do it, or if there's now a better method?
1 Reply
Asian black bear
This is somewhat unreliable and it's not a good idea to use such an important special character (which is likely to cause other issues anyways) for URLs.