Search code examples
gatsbyaws-amplify

Gatsby Js redirects all pages to index page when the page is opened directly


I have a website in Gatsby Js. I have deployed it to AWS Amplify.

When I try to open a page directly, say /pricing, it is redirecting to the home page. I am able to open the page when I click on any tag linking to that page.

Following is my build settings for AWS Amplify:

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - npm install -g gatsby-cli
        - npm install
    build:
      commands:
        - gatsby build
  artifacts:
    baseDirectory: public
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

Any clue where the issue can be?


Solution

  • For those who may face the same issue. It has been fixed by double-checking AWS Amplify redirection rules.