Chandan dutta
Chandan dutta

Reputation: 1

Redirection method in next js but with a status code of 308 not the 307 and also how to do this for params in url

In Next js 14 I have routes like this /[title]/[location]?page=1. for page=1 I have data in the page but for page=9 i don't have any data and I want to redirect them to the /[title]/[location] page, but here is a catch. A normal redirect method will give a status code of 307 but i want 308 status code for that redirection. How can we do this in next js 14 using next js config file? or if there is any other possibility?

I want a status code of 308 so that the redirection happen in permanently instead of 307 which is temporary redirection. and I tried to change the config file but the problem is how am i supposed to tell them that after 9th page i have no data as it is depending on the api response if my products list exceeded the 8th page then the 9th page will get valid but for now the 9th page has no data so I want to redirect them to the first page

Upvotes: 0

Views: 113

Answers (0)

Related Questions