Comments (6)
Which 404 page gets served depends on your server. Most servers send /404.html
whenever they receive a request to a nonexistent route. If you want to make it serve /fr/404.html
, you have to configure your server to redirect all /fr/*
to /fr/404.html
. For example, check out https://github.com/facebook/docusaurus/blob/main/website/static/_redirects. This is going to be different for each server.
Maybe we can add this to the docs.
from docusaurus.
Yes we should document this. Not easy though because we can't write a full guide to all the existing hosting platforms. But we can give a few generic hosting recommendations.
I also want to give a few tips like setting caching headers for assets, leveraging Webpack persistent caching etc... Not sure where to put that, the deployment page is already quite messy and long. Maybe we need a whole sidebar category just for deployment?
I deployed docusaurus directly on my local machine without using a web hosting service.
What does "deployed" mean, you must be running something on your local machine.
docusaurus serve
CLI is a possibility but there are many others including Apache, Nginx, arnish, http-server, serve...You should read the doc of the tool you use, and see if it's possible to redirect 404 reponses to the
/<locale>/404.html
file.Note that
docusaurus serve
is not particularly the best option, as we document here: https://docusaurus.io/docs/deployment#self-hostingI don't think we expose any way to serve the localized 404 page, but that could be an interesting thing to add automatically. This is the lib we use under the hood and it supports rewrites: https://github.com/vercel/serve-handler
If you use something else, you'd have to figure it out because we don't provide support for anything else than
docusaurus serve
.
OK, I understand. I use docusaurus serve. I will follow your advice and adjust my website according to the deployment section in the document. Thank you!
Maybe you can consider adding why you need a hosting service and the advantages of using a hosting service in the deployment document. This is just a suggestion.
Thanks for your reply!
from docusaurus.
Which 404 page gets served depends on your server. Most servers send
/404.html
whenever they receive a request to a nonexistent route. If you want to make it serve/fr/404.html
, you have to configure your server to redirect all/fr/*
to/fr/404.html
. For example, check out https://github.com/facebook/docusaurus/blob/main/website/static/_redirects. This is going to be different for each server.Maybe we can add this to the docs.
What should I do if I don't use a hosting service?
from docusaurus.
What are you using?
from docusaurus.
What are you using?
I deployed docusaurus directly on my local machine without using a web hosting service.
from docusaurus.
Yes we should document this. Not easy though because we can't write a full guide to all the existing hosting platforms. But we can give a few generic hosting recommendations.
I also want to give a few tips like setting caching headers for assets, leveraging Webpack persistent caching etc... Not sure where to put that, the deployment page is already quite messy and long. Maybe we need a whole sidebar category just for deployment?
I deployed docusaurus directly on my local machine without using a web hosting service.
What does "deployed" mean, you must be running something on your local machine. docusaurus serve
CLI is a possibility but there are many others including Apache, Nginx, arnish, http-server, serve...
You should read the doc of the tool you use, and see if it's possible to redirect 404 reponses to the /<locale>/404.html
file.
Note that docusaurus serve
is not particularly the best option, as we document here: https://docusaurus.io/docs/deployment#self-hosting
I don't think we expose any way to serve the localized 404 page, but that could be an interesting thing to add automatically. This is the lib we use under the hood and it supports rewrites: https://github.com/vercel/serve-handler
If you use something else, you'd have to figure it out because we don't provide support for anything else than docusaurus serve
.
from docusaurus.
Related Issues (20)
- npm2yarn converts command incorrectly for PNPM HOT 1
- Blog authors page is not using baseUrl when rendering a relative author.image_url HOT 5
- Footer links are too wide in mobile view which leads to misclicks HOT 1
- [@docusaurus/plugin-client-redirects] Not working with external links HOT 6
- plugin-pwa: Usage of placeholders in manifest.json allowing implementation of manifest.json for different deployment environments HOT 1
- Inconsistent File Handling Between Development and Build Processes HOT 3
- Do not transform static JS assets HOT 6
- Unicode in Navlinks broken on NodeJS 22 HOT 3
- `float`ing images overlap background of boxes (code boxes, admonitions, etc.) HOT 8
- Regarding plugin @docusaurus/plugin-client-redirects can't set redirection settings for other languages HOT 2
- DocCardList element renders the wrong items HOT 1
- Adding `@babel/preset-react` to docusaurus does not enable "Support for the experimental syntax 'jsx'" HOT 3
- `@docusaurus/eslint-plugin` is not compatible with ESLint 9 HOT 4
- Update dependencies to non-vulnerable versions HOT 8
- Firefox: Triple click + Ctrl+c in code block copies two lines instead of one HOT 2
- Setting `id` frontmatter unexpectedly affects the published path of a document HOT 2
- Make auto-generated multiple sidebars exclusive by default HOT 1
- --ifm-color-primary not used unless USE_SIMPLE_CSS_MINIFIER=true is set HOT 3
- Option to Alphabetically Sort Items in the Sidebar Menu HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docusaurus.