当前位置: 首页 > 软件库 > Web应用开发 > >

trailing-slash-guide

授权协议 MIT License
开发语言 JavaScript
所属分类 Web应用开发
软件类型 开源软件
地区 不详
投 递 者 张高澹
操作系统 未知
开源组织
适用人群 未知
 软件概览

Trailing Slash Guide

Have trailing slash problems after deploying a static website in production?

This repo explains factually the behavior of:

We also suggest some possible solutions

Intro

Let's get more familiar with trailing slash issues.

Common problems:

  • SEO/perf issues: when browsing /myPath, your host redirects to /myPath/
  • 404 issues: relative link such as <a href="otherPath"> are resolved differently (/otherPath or /myPath/otherPath depending on the presence/absence of a trailing slash
  • UX issues: your host adds a trailing slash, and later your single-page-application frontend router removes it, leading to a confusing experience and flickering url

Causes:

  • static site generators can emit different files for the same path /myPath: /myPath.html or /myPath/index.html (the later can lead to an additional trailing slash)
  • host providers all have a different behavior when serving static files, there is no standard

Summary

Considering this static site:

static
│
├── file.html
│
├── folder
│   └── index.html
│
├── both.html
└── both
    └── index.html

Behavior of various static hosting providers:

Host Settings Url /file /file/ /file.html /folder /folder/ /folder/index.html /both /both/ /both.html /both/index.html
GitHub Pages link �� 404 ➡️ /folder/
Netlify Default link ➡️ /file ➡️ /folder/ ➡️ /both
Netlify Pretty Urls on link ➡️ /file ➡️ /folder/ ➡️ /both
Netlify Pretty Urls off link
Vercel Default link �� 404 �� 404
Vercel cleanUrls=false trailingSlash=undefined link �� 404 �� 404
Vercel cleanUrls=false trailingSlash=false link �� 404 �� 404 ➡️ /folder ➡️ /both
Vercel cleanUrls=false trailingSlash=true link �� 404 �� 404 ➡️ /folder/ ➡️ /both/
Vercel cleanUrls=true trailingSlash=undefined link �� 404 �� 404
Vercel cleanUrls=true trailingSlash=false link ➡️ /file ➡️ /file ➡️ /folder ➡️ /folder ➡️ /both ➡️ /both ➡️ /both
Vercel cleanUrls=true trailingSlash=true link ➡️ /file/ ➡️ /file/ ➡️ /folder/ ➡️ /folder/ ➡️ /both/ ➡️ /both/ ➡️ /both/
Cloudflare Pages link ➡️ /file ➡️ /file ➡️ /folder/ ➡️ /folder/ ➡️ /both ➡️ /both/
Render link
Azure Static Web Apps link �� 404

Help Wanted

Let's keep this resource up-to-date, and make it exhaustive together.

  • Golden rule Every line of code should appear to be written by a single person, no matter the number of contributors. 1.Syntax Use soft tabs with two spaces—they're the only way to guarantee code rende

  • 6. Sqoop Tools 6.1. Using Command Aliases 6.2. Controlling the Hadoop Installation 6.3. Using Generic and Specific Arguments 6.4. Using Options Files to Pass Arguments 6.5. Using Tools 6.1。使用命令别名 6.2。

 相关资料
  • 添加尾部斜杠 在请求的 uri 后加上反斜杠 使用 e := echo.New() e.Pre(middleware.AddTrailingSlash()) 去除尾部斜杠 在请求的 uri 后去除反斜杠 用法 e := echo.New() e.Pre(middleware.RemoveTrailingSlash()) 自定义配置 使用 e := echo.New() e.Use(middlewa

  • Slash用perl编写,是一个数据库驱动的新闻与信息发布平台。运行环境(Apache+mysql+perl)。slash具有所有的公告板和新闻发布系统的特征。功能强大且易于定制。你可以很容易得完成适合自己的代码或皮肤的定制。这些工作都通过操作数据库中的数据记录完成。----Slash是真正的数据野兽。

  • 这是一个用来对 NSAttributedString 进行样式化的简单、可扩展的标识语言,跟 HTML 很像,不过每个标签都可以自定义。 要求:ARC. Requires iOS >= 4.3. Requires OS X >= 10.6.

  • Question leetcode: Factorial Trailing Zeroes | LeetCode OJ lintcode: (2) Trailing Zeros Write an algorithm which computes the number of trailing zeros in n factorial. Example 11! = 39916800, so the o

  • Factorial Trailing Zeroes 描述 Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 分析 对任意一个正整数 n 进行质因数分解,$$n = 2^x3^y5^z...$$ ,末

  • 问题内容: This question already has answers here : How to nicely format floating numbers to String without unnecessary decimal 0? (26 answers) Closed 6 years ago. For example I need to become , or to beco