DEV Community

Aashabul Imam
Aashabul Imam

Posted on

deploy Gatsby site in Hostinger in a subfolder directory

When I host my site in the root directory the links work fine. But having problem in a subfolder like this "https://main-domain.com/projects". Every time I click any link it redirects me to "https://main-domain.com".

But I want my root directory to be "https://main-domain.com/projects".

in gatsby-config.js used

module.exports = {
  pathPrefix: `/projects`,
assetPrefix: `https://main-domain.com`,
}
Enter fullscreen mode Exit fullscreen mode

also built the site with the command

gatsby build --prefix-paths
Enter fullscreen mode Exit fullscreen mode

but it always sends me back to the "https://main-domain.com" path.
How to solve that?

Top comments (0)