-
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
[gatsby-plugin-remove-trailing-slashes] results in 301 redirects #9025
Comments
This is most likely a server config issue, see the plugin docs. |
Thanks Stefan, think you're right. |
Was this also happening for you on the development servers? |
Yes @drewatk, I have since learned that node server also does something similar |
I'm encountering this, too. Locally, using surge, and in production. The redirect is removing our tracking query params, as well, which is why I'm searching for a solution. Anyone have any ideas? |
I think there might be 2 ways of doing this:
I'll try to remember to post back here once we've implemented it to let you know the results of our implementation. |
Description
I am rebuilding a site that traditionally has no trailing slashes on each page. I've tried using both the plugin gatsby-remove-trailing-slashes and the method hilighted here: https://www.gatsbyjs.org/docs/creating-and-modifying-pages/#removing-trailing-slashes
Both of these result in a redirect, which you can see in the network panel.
Is there a way of removing trailing slashes without the redirect?
Steps to reproduce
Add the following to the gatsby-node file:
Expected result
Actual result
A 301 redirect is logged in the console:
Environment
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.11.0 - /usr/local/bin/node
Yarn: 1.7.0 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Browsers:
Chrome: 69.0.3497.100
Firefox: 62.0
Safari: 12.0
npmPackages:
gatsby: ^2.0.14 => 2.0.14
gatsby-plugin-canonical-urls: ^2.0.6 => 2.0.6
gatsby-plugin-google-analytics: ^2.0.5 => 2.0.6
gatsby-plugin-google-tagmanager: ^2.0.5 => 2.0.5
gatsby-plugin-manifest: ^2.0.4 => 2.0.4
gatsby-plugin-react-helmet: ^3.0.0 => 3.0.0
gatsby-plugin-robots-txt: ^1.3.0 => 1.3.0
gatsby-plugin-sitemap: ^2.0.1 => 2.0.1
gatsby-plugin-styled-components: ^3.0.0 => 3.0.0
gatsby-source-apiserver: ^2.0.0 => 2.0.0
gatsby-source-filesystem: ^2.0.1 => 2.0.1
gatsby-source-wordpress: ^3.0.0 => 3.0.1
gatsby-transformer-javascript-frontmatter: ^2.0.0 => 2.0.0
gatsby-transformer-json: ^2.1.2 => 2.1.2
npmGlobalPackages:
gatsby-cli: 2.4.3
The text was updated successfully, but these errors were encountered: