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 Manages Trailing Slashes in URLs?
Controlling whether URLs have a trailing slash or not does not usually require any extra plugins. WordPress manages this through the "Custom Structure" field in the Permalink Settings.

To change it, go to "Settings -> Permalinks" and adjust the field:
- Add trailing slashes
To include trailing slashes in URLs, add a slash at the end.
Because the structure field ends in a slash (see red arrow), the trailing slashes will be automatically added to all URLs. - Remove trailing slashes
Remove the slash at the end if you prefer URLs without trailing slashes.
To remove the trailing slash from WordPress permalinks, simply make sure the structure does not end with a slash.
Regardless of whether you decide to include trailing slashes in the URLs or not, you need make sure that only one version is available in order to avoid the "duplicated content" SEO issue. Redirecting non-trailing slash URLs to trailing slash URLs or vice versa is an effective way to prevent it.
Canonical URLs are handled by WordPress to some extent with the canonical redirect, however this functionality may be affected by factors such as server configuration, caching, and 3rd party plugins.
Permalink Manager 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.

Trailing Slash Inconsistency
Does Trailing Slash Matter for SEO?
While most people do not notice whether a URL ends with a slash, search engine crawlers can interpret it differently. If the same page is accessible both with and without a trailing slash, search engines may treat them as separate pages.
This can complicate crawling and use up more of your crawl budget, since each URL has to be processed separately.

Cache Plugins Issues
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.
Managing Trailing Slash Redirects via Server Configuration
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;
				}
			}
		}
	}
}