Skip to content

This issue is being moved to a discussion.

You can continue the conversation there. Go to discussion →

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

CreateRedirect doesn't work with wildcard routes(/*) #36521

Open
2 tasks done
YaroslavTrussle opened this issue Sep 2, 2022 · 2 comments
Open
2 tasks done

CreateRedirect doesn't work with wildcard routes(/*) #36521

YaroslavTrussle opened this issue Sep 2, 2022 · 2 comments
Labels
stale? Issue that may be closed soon due to the original author not responding any more. status: needs more info Needs triaging and reproducible examples or more information to be resolved

Comments

@YaroslavTrussle
Copy link

Preliminary Checks

Description

Redirection for old url /* doesn’t work. It says page not found instead of redirection.

Reproduction Link

https://codesandbox.io/s/misty-tree-7bth4u?file=/gatsby-node.js

Steps to Reproduce

  1. Go to the /blog/sdfsdf(any random string) url.

...

Expected Result

Redirect from wildcard route to the homepage

Actual Result

Shows 404 page, doesn’t redirect.

Environment

System:
    OS: macOS 12.5.1
    CPU: (8) arm64 Apple M2
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
    npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
  Languages:
    Python: 2.7.18 - /Library/Frameworks/Python.framework/Versions/2.7/bin/python
  Browsers:
    Chrome: 104.0.5112.101
    Safari: 15.6.1
  npmPackages:
    gatsby: ^4.22.0 => 4.22.0
    gatsby-cli: ^4.22.0 => 4.22.0
    gatsby-plugin-gatsby-cloud: ^4.22.0 => 4.22.0
  npmGlobalPackages:
    gatsby-cli: 4.22.0

Config Flags

No response

@YaroslavTrussle YaroslavTrussle added the type: bug An issue or pull request relating to a bug in Gatsby label Sep 2, 2022
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Sep 2, 2022
@marvinjude
Copy link
Contributor

marvinjude commented Sep 5, 2022

Hi @YaroslavTrussle,

Is your site hosted on Gatsby Cloud?

Does this work locally with gatsby develop and gatsby serve?

createRedirect will only work out-of-the-box if you're hosted on Gatsby cloud(As stated in the createRedirect docs)

@marvinjude marvinjude added status: needs more info Needs triaging and reproducible examples or more information to be resolved and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: bug An issue or pull request relating to a bug in Gatsby labels Sep 5, 2022
@YaroslavTrussle
Copy link
Author

locally I typed npm run build then gatsby serve. CreateRedirect with exact url /.../... works fine but if I wanted to redirect from all old ones /.../* it was not working.

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Sep 25, 2022

This issue is being moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
stale? Issue that may be closed soon due to the original author not responding any more. status: needs more info Needs triaging and reproducible examples or more information to be resolved
Projects
None yet
Development

No branches or pull requests

2 participants