Skip to content
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

How to fix the issue of link without / #411

Closed
andymok221 opened this issue Sep 1, 2016 · 1 comment
Closed

How to fix the issue of link without / #411

andymok221 opened this issue Sep 1, 2016 · 1 comment

Comments

@andymok221
Copy link

I begin with the doc site starter. However http://localhost:8000/examples goes to 404 page while http://localhost:8001/examples/ works. Is there any way to fix this? I want those without trailing slash will redirect to the one with trailing slash.

@KyleAMathews
Copy link
Contributor

This is something you have to setup with your web server.

What happens when you visit /examples/ is that the web server traverses the file system looking for something to deliver — they see that examples is a directory and so they look to see if there's an index file for that directory aka index.html and if there is, serves that.

Almost every web server does this by default which is why Gatsby outputs files at index.html. If you want to remove the trailing slash, there are ways but it'll take special configuration.

Here's a blog post I found for Nginx. No guarantee on its quality though as not an Nginx expert http://cobwwweb.com/remove-html-extension-and-trailing-slash-in-nginx-config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants