1. Home
  2. Docs
  3. Tutorials
  4. Trailing slashes in WordPress permalinks

Trailing slashes in WordPress permalinks

Generally, the URLs pointing to a directories end with a slash and files’ URLs do not have them. In practical terms, on some of WordPress websites the trailing slashes are added to all permalinks. While the rest of them does not use them at all.

# URLs without a trailing slash
http://example.com/wp-content/uploads/2020/01/sample-image.jpg
http://example.com/blog/sample-wordpress-post-ends-without-trailing-slash

# URLs with a trailing slash
http://example.com/wp-content/uploads/2020/01/
http://example.com/blog/another-wordpress-post-ends-with-trailing-slash/

Add or remove trailing slashes to all WordPress permalinks

You can use Permalink Manager to either add or remove the trailing slashes from all WordPress permalinks. The new settings will be globally applied to all posts, pages, categories and term URLs.

Based on your preference, in the plugin settings you can either choose to:

  • keep native settings
  • force trailing slashes (and if needed auto-redirect permalinks without them) in all WordPress permalinks
  • remove trailing slashes (and if needed auto-redirect permalinks with them) from all WordPress permalinks
You can get back to original mode at any moment! To revert the changes please select “Use default settings” in Permalink Manager settings.

How does it work?

The plugin filters $wp_rewrite->use_trailing_slashes property/variable, so all WordPress permalinks (not only the ones filtered with Permalink Manager) will be affected.

It is also possible to exclude the specific post types & taxonomies from Permalink Manager trailing slashes settings. Here you can find more information on how to do so.