Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

url

Rules: 9

url/double-slash

The URL path has an empty segment

url/double-slash/present · warning · score 4.9 · page

A doubled slash can serve the same page at two addresses, which splits links and ranking between them. Only pages that answer 2xx are checked.

Reported as

the path has an empty segment

Fix

Remove the doubled slash from the links, and redirect the doubled path to the single one.

Runs by default, in the recommended ruleset.

References

For rule authors

Reads

  • url.pathname

Expects

{
  "type": "string",
  "not": {
    "pattern": "//"
  }
}

When

{
  "http.status": {
    "minimum": 200,
    "maximum": 299
  }
}

url/extension

The URL path shows the server technology in its extension

url/extension/present · hint · score 0.6 · page

Extensions such as .php or .aspx tie the address to one technology, so links break when the site changes its stack, and they tell attackers what it runs. Only pages that answer 2xx are checked. This is a minor hint.

Reported as

the path exposes the server technology in its extension

Fix

Serve the page at an extensionless path, and redirect the old one to it.

Runs by default, in the recommended ruleset.

References

For rule authors

Reads

  • url.pathname

Expects

{
  "type": "string",
  "not": {
    "pattern": "(?i:\\.(php|aspx?|jsp|cgi|html?)$)"
  }
}

When

{
  "http.status": {
    "minimum": 200,
    "maximum": 299
  }
}

url/href

The URL is longer than 100 characters

url/href/length · info · score 1.8 · page

Long URLs are hard to read, share and remember, and are often cut off in search results and messages. Only pages that answer 2xx are checked.

Reported as

the URL is longer than 100 characters

Fix

Shorten the path to the few words that name the page.

Runs by default, in the recommended ruleset.

References

For rule authors

Reads

  • url.href

Expects

{
  "type": "string",
  "maxLength": 100
}

When

{
  "http.status": {
    "minimum": 200,
    "maximum": 299
  }
}

url/path

The URL path is not lowercase with hyphens

url/path/invalid · info · score 2.8 · page

Mixed case, underscores and empty segments make URLs harder to read, share and type, and a server may treat each form as a separate page. Only pages that answer 2xx are checked.

Reported as

URL path should be lowercase, with hyphens and no empty segment

Fix

Rewrite the path to be lowercase, with hyphens and no empty segments.

Runs by default, in the recommended ruleset.

References

For rule authors

Reads

  • url.pathname

Expects

{
  "type": "string",
  "pattern": "^(?!.*//)(%[0-9A-Fa-f]{2}|[^A-Z_%])*$"
}

When

{
  "http.status": {
    "minimum": 200,
    "maximum": 299
  }
}

url/separator

URLs join words with different separators

url/separator/inconsistent · warning · score 4.4 · site

Mixing hyphens and underscores makes URLs hard to guess and type, and search engines read a hyphen as a word break but an underscore as part of one word. Reported for the pages that use the separator fewer pages of the site use.

Fix

Join the words of every URL with hyphens, and redirect the others to them.

Runs by default, in the recommended ruleset.

References

For rule authors

Reads

  • url.pathname

When

{
  "http.status": {
    "minimum": 200,
    "maximum": 299
  }
}

url/session-param

The URL carries a session ID

url/session-param/present · warning · score 5.8 · page

Every visitor gets a different address for the same page, so search engines see endless duplicates, and a shared link can hand over someone’s session. Only pages that answer 2xx are checked.

Reported as

the URL carries a session ID

Fix

Keep the session in a cookie, never in the URL.

Runs by default, in the recommended ruleset.

References

For rule authors

Reads

  • url.href

Expects

{
  "type": "string",
  "not": {
    "pattern": "(?i:[?&;](sid|sessionid|jsessionid|phpsessid)=)"
  }
}

When

{
  "http.status": {
    "minimum": 200,
    "maximum": 299
  }
}

url/slug

The URL slug is an identifier or shares no word with the title

url/slug/unreadable · info · score 2.0 · page

A readable URL tells visitors and search engines what the page is about before it loads, and is easier to share and remember. Paginated listings are left out.

Fix

Name the page in its URL with words from its title, as /spring-recipes for “Spring recipes”.

Runs by default, in the recommended ruleset.

References

For rule authors

Reads

  • url.pathname
  • html.title
  • html.h1
  • html.rels
  • graph.prev

When

{
  "http.status": {
    "minimum": 200,
    "maximum": 299
  }
}

url/trailing-slash

URLs of a group differ in their trailing slash

url/trailing-slash/inconsistent · warning · score 4.3 · site

A URL with and without a trailing slash can be two separate pages, so the same content may be indexed twice and links, shares and cache entries are split between them. The root, file names and well-known URIs are skipped.

Fix

Pick one form, with or without the trailing slash, and redirect the other to it.

Runs by default, in the recommended ruleset.

References

For rule authors

Reads

  • url.pathname

When

{
  "http.status": {
    "minimum": 200,
    "maximum": 299
  }
}

url/uppercase

The URL path has uppercase letters

url/uppercase/present · warning · score 5.1 · page

A server may treat /About and /about as different pages, which splits links and ranking and makes the page reachable at several addresses. Only pages that answer 2xx are checked.

Reported as

the path has uppercase letters, which a server may treat as another URL

Fix

Use lowercase paths, and redirect each mixed-case path to its lowercase form.

Runs by default, in the recommended ruleset.

References

For rule authors

Reads

  • url.pathname

Expects

{
  "type": "string",
  "not": {
    "pattern": "(?<!%)(?<!%[0-9A-Fa-f])[A-Z]"
  }
}

When

{
  "http.status": {
    "minimum": 200,
    "maximum": 299
  }
}