-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Rewrite path #14788
Comments
You should be able to do this using path prefixes. Read more about this at https://www.gatsbyjs.org/docs/path-prefix/ |
Wow, how quickly closed the question) |
@TibiTotoro Sorry for closing this too soon! Let me elaborate. Path prefixes let you host at something other than at the the root (/) of the domain. For example in your case, you could build the sites for each sub domain independently and put in folders demo/subdimain1, demo/subdimain2, demo/subdimain3. For this, you would set the path prefix as /subdimain1, /subdimain2 and /subdimain3 respectively. |
I understand correctly that you propose to run build several times, each time with your own path-prefix and put the files into different folders? Is there any way to automate this (there are many subdomains)? Is there any way to avoid duplication of static content such as images and documents that are the same for subdomains? If I duplicate static content 30-40 times, the output project will be terribly large. |
@sidharthachatterjee: path-prefix allows to host at something other than /, but it doesn't allow you to host at something other than / while, at the same time, serving at a different URL where it's in the filesystem, because first thing gatsby app does is a "canonical check": in #4337 there was a proposal to introduce a config variable to disable such redirect, but was closed in favor of a workaround that doesn't work anymore. |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contributefor more information about opening PRs, triaging issues, and contributing! Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing! Thanks again for being part of the Gatsby community! |
Wouldn't this approach work? |
For some pages, i want to to change the URL path in the router to not map directly to the path on the filesystem.
These pages will be placed on subdomains, all such pages are building to a folder /test/, we get /test/subdomain1/index.html, /test/subdomain2/index.html, /test/subdomain3/index.html etc.
Redirection is configured by Nginx, but gatsby take path from gatsby-script-loader and a page subdomain.domain.com redirected to subdomain.domain.com/test/subdomain1/index.html
I saw that a similar question about path rewriting was raised in #3113 and #383 but there is no solution to these questions.
Is there any solution to this problem? Thanks!
The text was updated successfully, but these errors were encountered: