trailing slash guide
1.0.0
¿Tiene problemas de corte trasero después de implementar un sitio web estático en producción?
Este repositorio explica de hecho el comportamiento de:
También sugerimos algunas posibles soluciones
Vamos a familiarizarnos más con los problemas de corte.
Problemas comunes :
/myPath , su anfitrión redirige a /myPath/<a href="otherPath"> se resuelve de manera diferente ( /otherPath o /myPath/otherPath dependiendo de la presencia /ausencia de una barra de corte finalCausas :
/myPath : /myPath.html o /myPath/index.html (el último puede conducir a una barra de arrastre adicional)Teniendo en cuenta este sitio estático:
static
│
├── file.html
│
├── folder
│ └── index.html
│
├── both.html
└── both
└── index.htmlComportamiento de varios proveedores de alojamiento estático:
| Anfitrión | Ajustes | Url | /archivo | /archivo/ | /file.html | /carpeta | /carpeta/ | /folder/index.html | /ambos | /ambos/ | /both.html | /both/index.html |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Páginas de Github | enlace | ✅ | ? 404 | ✅ | ➡️ /carpeta / | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| Netlificar | Valor predeterminado: bonitas urls en | enlace | ✅ | ➡️ /archivo | ✅ | ➡️ /carpeta / | ✅ | ✅ | ✅ | ➡️ /Ambos | ✅ | ✅ |
| Netlificar | Bonitas urls apagadas | enlace | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Velo | Predeterminado: cleanurls = falso trailingslash = indefinido | enlace | ? 404 | ? 404 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Velo | CleanUrls = False TrailingsLash = False | enlace | ? 404 | ? 404 | ✅ | ✅ | ➡️ /carpeta | ✅ | ✅ | ➡️ /Ambos | ✅ | ✅ |
| Velo | CleanUrls = False TrailingsLash = True | enlace | ? 404 | ? 404 | ✅ | ➡️ /carpeta / | ✅ | ✅ | ➡️ /ambos / | ✅ | ✅ | ✅ |
| Velo | CleanUrls = True TrailingsLash = Undefined | enlace | ✅ | ✅ | ➡️ /archivo | ✅ | ✅ | ➡️ /carpeta | ✅ | ✅ | ➡️ /Ambos | ➡️ /Ambos |
| Velo | CleanUrls = True TrailingsLash = False | enlace | ✅ | ➡️ /archivo | ➡️ /archivo | ✅ | ➡️ /carpeta | ➡️ /carpeta | ✅ | ➡️ /Ambos | ➡️ /Ambos | ➡️ /Ambos |
| Velo | CleanUrls = True TrailingsLash = True | enlace | ➡️ /archivo / | ✅ | ➡️ /archivo / | ➡️ /carpeta / | ✅ | ➡️ /carpeta / | ➡️ /ambos / | ✅ | ➡️ /ambos / | ➡️ /ambos / |
| Páginas de Cloudflare | enlace | ✅ | ➡️ /archivo | ➡️ /archivo | ➡️ /carpeta / | ✅ | ➡️ /carpeta / | ✅ | ✅ | ➡️ /Ambos | ➡️ /ambos / | |
| Prestar | enlace | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
| Aplicaciones web estáticas de Azure | enlace | ✅ | ➡️ /archivo | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Mantengamos este recurso actualizado y lo hagamos exhaustivo juntos.