Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 404 management #377

Open
mhf-ir opened this issue Jan 15, 2025 · 1 comment
Open

feat: 404 management #377

mhf-ir opened this issue Jan 15, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@mhf-ir
Copy link

mhf-ir commented Jan 15, 2025

🆒 Your use case

For website want to migrate into Nuxt old website could have different routing strategy. like wordpress:
http://example.com/?p=234
http://example.com/content/1234
http://example.com/fully-slug-without-id-or-something
... and much much

why called it 404 because it's should check after all current defined route, before throw 404 must run.

🆕 The solution you'd like

instead of define rewrite in nginx or even nuxt it's would be nice to to control over 404 and define several strategiy if one of them solved then nuxt must be work and application also
for example:

consider new route is /my-new-content/:id

[
    { match: /content\/(\d+)/, (m) => {  
        // redirect into `/my-new-content/:id`
     )}}, // for redirect
    { match: /content\/(\d+)/, (m) => {  
         // get data from `/my-new-content/:id` and serve it but with new cannonical
         // it's save crawler budget and eventually new url will be applied on search engines
         // https://developers.google.com/search/blog/2017/01/what-crawl-budget-means-for-googlebot
    }}, // for proxy
    { fetch: async function (req) => {
        // check old url mapping in backend database for example in slug, if found then use
        // if found redicert or proxy 
        // on this step also server can log 404 request and manage it if want to redirect or something
    }), // for backend process
    // now 404 could be happened
]

🔍 Alternatives you've considered

No response

ℹ️ Additional info

No response

@mhf-ir mhf-ir added the enhancement New feature or request label Jan 15, 2025
@davidstackio
Copy link

Have you considered using routeRules?

Also, for advanced usage: https://www.youtube.com/watch?v=ALQcCDEusjI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants