WordPress usually handles trailing slashes automatically, redirecting URLs with or without a trailing slash to a consistent version. Still, some server settings or plugins may block these redirects, which may lead to duplicate content that can reduce SEO performance.
To prevent this, decide whether your links will include a trailing slash or not. It is important because search engines may treat URLs with and without the slash as separate pages.
The way WordPress handles trailing slashes depends on its built-in permalink settings. If you are new to WordPress, these settings can be hard to find in the dashboard. In this guide, you will learn where to find them and set your URLs to your preferred format.
What Are the Trailing Slashes?
In URLs, slashes separate folders and subfolders, showing how content is organized on a website. For example, in /products/olive/greece/, each slash divides the main folder from its subfolders.
A trailing slash at the end of a URL usually means the link points to a folder or directory. This helps distinguish them from single file URLs like images, which typically end with a file extension like .jpg or .css instead of a slash.

Trailing slashes in WordPress URLs are configurable and in practice, many websites do not always adhere to this rule. You can choose to include one or not, depending on your preference, but make sure all your links follow the same format.
How WordPress Decides to Add a Slash
WordPress manages trailing slash behavior through a global object called $wp_rewrite. This object holds your permalink settings, stores the rewrite rules that match URL patterns to content types, and controls whether URLs end with a slash or not.
The specific property that controls the trailing slashes is
$wp_rewrite->use_trailing_slashes
. This flag is a simple boolean value that WordPress sets automatically based on the permalink structure in "Settings -> Permalinks".

$wp_rewrite->use_trailing_slashes
flag is set to true. If it does not, the flag is false.This WordPress function respects the website’s trailing slash preference and applies the correct format automatically.
Configuration Conflicts
Problems usually occur when your server configuration files, such as .htaccess on Apache or nginx.conf on NGINX, contain rules that do not match your WordPress permalink settings.
WordPress may force URLs to include a trailing slash, while server redirects remove it, or the opposite happens. Third-party plugins can trigger the same conflict. This often happens with SEO, caching, security, or multilingual plugins.
When they are set up incorrectly, or when they inject additional .htaccess rules, they try to correct URLs that WordPress already considers as valid, which can lead to redirect loops and other SEO issues.
Common Issues Caused by Trailing Slashes
Duplicate Content
Whether you choose to use trailing slashes in your URLs or not, make sure only one URL version is accessible. If Google encounters both versions of a URL, it has to decide which one to treat as the original, and it does not always get that right.
This wastes crawl budget, risks splitting page authority between duplicated content, and can delay indexing of your most important pages.
WordPress usually addresses this his by redirecting non-trailing slash URLs to trailing slash URLs, or the other way around. That said, certain server settings, caching tools, or third-party extensions may affect how this works.
If you notice that trailing slash redirects are not working as expected, the most dependable solution is to handle it at the server level.

Cache and CDN Conflicts
To minimize server resource usage, cache plugins (e.g. WP Rocket) store only one version of a URL, either with or without trailing slashes. As a result, PHP-based redirects, such as the built-in canonical redirect in WordPress or the Permalink Manager trailing slash functions, may fail.
Because of the script cache, the aforementioned functions will not be able to detect whether the URL ends with a slash or not.
If the PHP-based trailing slash redirect isn’t working due to cache plugin, you can configure the server to process the redirect earlier, before PHP runs. The next sections of this article include additional tips on how to accomplish this.
Google Analytics Reports
In addition, if your website handles trailing slashes inconsistently, it is possible that duplicate URLs may appear in your Google Analytics results. While past statistics cannot be fixed, you can adjust the future collection of data to avoid this issue.

Thankfully, it can be avoided with a straightforward fix. The first option is to apply the URL filters that are included into Google Analytics. There are numerous articles, such as this one, that explain how to use them.
However, forcing one version of the URL via a "301" redirect directly on your server is the most reliable and recommended method. You may accomplish this by adjusting server configuration or by using a third-party plugin like Permalink Manager.
How to Control Trailing Slashes Without a Plugin?
In most cases, no additional plugin is required to manage trailing slashes in URLs. WordPress handles this natively through the "Custom Structure" field under "Settings -> Permalinks".
If the structure ends with a slash, your site URLs will include a trailing slash. If the slash is removed, your URLs will appear without it.

How to Add Trailing Slashes?
To enforce trailing slashes across all URLs, simply add a slash at the end of the "Custom Structure" field in your permalink settings. Once saved, WordPress enforces the trailing slash across canonical URLs and handles canonical redirects accordingly.

How to Remove Trailing Slashes?
Removing trailing slashes follows the same logic as adding them. To do so, simply make sure the "Custom Structure" field does not end with a slash. WordPress will handle the rest automatically.

Permalink Manager Extra Settings
By default, Permalink Manager uses the native trailing slash settings, but you can adjust them in the plugin settings if needed. There is also an option to enable a trailing slash redirect, which improves the native canonical redirect.
"Trailing slashes" Mode
The plugin dynamically filters $wp rewrite->use_trailing_slashes property, therefore all WordPress permalinks (not only the ones filtered with Permalink Manager) will be affected. Of course, this also applies to meta tags (canonical URLs) and sitemaps built by third-party tools like Yoast SEO or RankMath.

"Trailing slashes redirect"
A canonical redirect is the quickest solution to address duplicate content issues caused by trailing slashes. If you choose to implement the 301 redirect, both users and search engine crawlers will always be sent to to one of two URL versions: with or without slashes.
If you do not know how to code, Permalink Manager may help you in using the redirect. To make it work and force your chosen slashes configuration, enable the "Trailing slashes redirect" option in the plugin settings.

How to Enforce WordPress Settings with Server-Level Redirects?
WordPress may not always redirect to the canonical URL. This can be caused by caching plugins or custom PHP code. To ensure a consistent URL structure, you can set up a server-level redirect using one of the below snippets:
Apache Servers
If you are using Apache server, you can try to address this issue by adding extra code snippet at the top of your .htaccess file in the main directory where WordPress is installed.
#
# A. Remove trailing slashes
#
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
#
# B. Force trailing slashes
#
RewriteEngine on
# Exclude files and directories under "wp-content", "wp-admin", "wp-json" and URLs with query parameters
RewriteCond %{REQUEST_URI} !^/?wp-(admin|json|content)
RewriteCond %{QUERY_STRING} ^$
# This rule should not be applied to URLs that look like filenames and already end with a trailing slash
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
# Check if the request URI does not end with a slash
RewriteCond %{REQUEST_URI} !(.+)/$
# If all conditions are met, redirect to the same URI with a trailing slash
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
NGINX Servers
While Apache allows easy modifications through .htaccess files, NGINX configuration is more complicated and often requires direct server access which might not be available on many hosting platforms.
In order to use the below snippet, you will need access to the NGINX configuration files on your server and know how to edit server blocks.
#
# A. Remove trailing slashes
# Place this inside server {} block
#
location / {
	# Don't remove slash from real directories
	if (!-d $request_filename) {
		# Remove trailing slash
		rewrite ^/(.*)/$ /$1 permanent;
	}
}
#
# B. Force trailing slashes
# Place this inside server {} block
#
location / {
	# Exclude WordPress admin, API, and content directories
	if ($request_uri !~ "^/?wp-(admin|json|content)") {
		# Exclude URLs with query parameters
		if ($args = "") {
			# Exclude files with extensions and URLs already ending with slash
			if ($request_uri !~ "\.[a-zA-Z0-9]{1,5}$") {
				if ($request_uri !~ "/$") {
					rewrite ^(.*)$ $1/ permanent;
				}
			}
		}
	}
}