rewrite URL
Unanswered
Persian posted this in #help-forum
PersianOP
Hello everyone,
I'm currently working on rewriting a URL. For instance, when I navigate to "test/plp," it should display the contents of "/plp." I'm using rewrite rules in my
I'm currently working on rewriting a URL. For instance, when I navigate to "test/plp," it should display the contents of "/plp." I'm using rewrite rules in my
next.config.js to achieve this functionality. However, I'd like the "test/" prefix to remain in the URL when navigating to other pages. Currently, when I navigate to a PDP page from "test/plp," it redirects me to "/plp" instead of "test/plp." How can I maintain the "test/" prefix in the URL?1 Reply
@Persian Hello everyone,
I'm currently working on rewriting a URL. For instance, when I navigate to "test/plp," it should display the contents of "/plp." I'm using rewrite rules in my `next.config.js` to achieve this functionality. However, I'd like the "test/" prefix to remain in the URL when navigating to other pages. Currently, when I navigate to a PDP page from "test/plp," it redirects me to "/plp" instead of "test/plp." How can I maintain the "test/" prefix in the URL?
are you doing this in the
next.config.js?/** @type {import('next').NextConfig} */
const nextConfig = {
async rewrites() {
return [
{
source: "/test/plp",
destination: "/plp",
},
];
},
};
module.exports = nextConfig;