Trailing slashes in URLs

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

A URL that ends with a slash (e.g., and the same URL but without that slash (e.g.,, are usually regarded as two different links. That has consequences for visitor analysis and tracking & tracing.


Why it is important to be consistent with how you write URLs:

  • Different URLs for Search Engines: From an SEO perspective, URLs with a trailing slash and without are considered two distinct URLs. For example, and are treated as separate URLs by search engines. Some problems with this: Dilution of PageRank + much more objects to take care of (e.g., in sitemaps)
  • Loss of click-id's: When a URL with a click-id as parameter is changed from/to the same with/without a trailing slash, the click-id gets lost
  • Potential Double Redirect: If you set up a redirect without the trailing slash but your new site's URL structure uses trailing slashes (and has canonical tags set up with the trailing slash or uses redirects to enforce this), then users might experience a double redirect. This can slow down the user experience slightly and is generally something to avoid.


Where this ambiguity concerning trailing URL slashes comes from: By convention, a trailing slash often indicates a directory, whereas no slash might imply a file. However, this distinction has been blurred with modern web practices and systems, as URLs often don't map directly to physical files or directories.


AFAIK, WordPress follows the usual guidelines concerning trailing slashes. Than why is there no trailing slash in option Numeric? Is there something special about links that end in a numerical code? - Let's ignore for now

By default, WordPress appends a trailing slash (/) to URLs for posts, pages, categories, and tags when using pretty permalinks. WordPress also redirects such links without slashes, to the corresponding link with a slash.

This is actually a quite practical way to check what kinds of links should or shouln't have trailing slashes: Just check in a WordPress site that's not specifically modified in this regard (see remarks about WP Rocket elsewhere).

For example:


However, there are some exceptions:

Exception Notes
Root URL
  • The root URL of a WordPress site doesn't get a trailing slash. You can't even specify such a URL (wp-admin » Settings) as WordPress will strip the trailing slash
  • To keep this consistent, don't include slashes when referring from one own site to another own site, e.g., through a site selector
  • To keep this intuitive, let's use the same syntaxis for external URLs. E.g.: but - However, this isn't really relevant, as we don't use track & trace on domains that we don't own. It's mostly to not get distracted
URLs with query parameters
URLs with local anchors
  • URLs like local anchors, probably don't get a trailing slash
  • E.g.:
Other protocols?
  • Email addresses surely don't get a slash. E.g.: <a href=""></a>
  • Telephone numbers probably don't get a slash. E.g.: <a href="tel:+31351234567">+31-35-123.45.67</a> - When regarded as an ordinary URL, this would be a root URL
  • WhatsApp links probably get a slash. E.g.: <a href="" target="_blank" rel="noopener">WhatsApp</a> - When regarded as an ordinary URL, this would not be a rool URL

If you're setting up redirects for a WordPress site, you should typically include the trailing slash in the destination URL to match the default behavior of WordPress. This ensures a smooth user experience and helps prevent any potential SEO issues.


Always end URLs with a slash, however...

  1. Not for parameter URLs
  2. Not for URLs with local anchors
  3. Not for links to files
  4. Not for root URLs
  5. Check for links to other protocols.

WP Rocket

In 2023.10, we found out that WP Rocket thwarts this default behaviour of WordPress, and doesn't append slashes. See WP Rocket & Redirects for details.

See also