Cookies disclaimer

I agree Our site saves small pieces of text information (cookies) on your device in order to deliver better content and for statistical purposes. You can disable the usage of cookies by changing the settings of your browser. By browsing our website without changing the browser settings you grant us permission to store that information on your device.

Trailing Slash Duplication

Trailing Slash Duplication

Contents:

Duplicate Content & Canonicalisation – Trailing Slashes on URLs

Before we get stuck in, lets first have a quick look at what a trailing slash is; a trailing slash is the forward slash ‘/’ that you often see at the end of a URL that has had the file suffix (.html & .php, etc) removed.

There is no special advantage or disadvantage to either having or not having a trailing slash, the problem arises when the site uses them inconsistently.

This article is one of several that fall under the duplicate content and canonicalisation series in the Raptor Knowledge Base. Please the below list for all other articles covering all of the different types of duplicate content and canonicalisation issues that a website can experience below:

Trailing Slashes on URLs

A common issue on sites, especially those that remove the document type suffix (.html .aspx .php) from URL’s is that trailing slashes can be present at the end of a URL. For example:

www.example.com.au/page/
www.example.com.au/directory/page/

Impact of Issue

When a web page is accessible from more than one URL, Google may choose to serve either one in the search results unless you specify which to serve. Duplicate content can be devalued by Google and other search engines, which can result in a loss of rankings, ­­ and consequently traffic for terms targeted on those pages.

Hence if a webpage is accessible with and without the trailing slash, this could have a negative impact on your website’s content.

How to Resolve

There are a number of steps that can be taken to ensure that this does not become an issue on your site. The first forces lowercase URLs to be used and the second is a catchall solution for duplicate content.

There is no ‘SEO’ reason to force URL’s to include or not include trailing slashes, it just makes more sense; so just chose which one you prefer.

Raptor Tools!

Use Raptor’s SEO tools to analyse your site to determine if there are any trailing slash duplication issues. Our SEO auditing and web crawler software can easily and quickly identify trailing slash duplication issues.

Redirects (.htaccess)

You will need ‘write / modify’ access to the website’s .htaccess file in order to implement this solution. We always warn people that modifying the .htaccess file can have drastic effects on website functionality if implemented incorrectly. Always test immediately after publishing changes to the file.

Copy the code below into the .htaccess file, save and upload it to the root of the domain overwriting the existing file.

# remove trailing slash
RewriteRule ^(.*)\/(\?.*)?$ $1$2 [R=301,L]

Redirects (Windows IIS)

For Windows servers using IIS, you will need to setup a rewrite rule using the code below to remove the trailing slash:

<rule name="Remove trailing slash" stopProcessing="true"> 
  <match url="(.*)/$" /> 
  <conditions> 
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
  </conditions> 
  <action type="Redirect" redirectType="Permanent" url="{R:1}" /> 
</rule>
Use the code below to force the keeping of the trailing slash:
<rule name="Add trailing slash" stopProcessing="true"> 
  <match url="(.*[^/])$" /> 
  <conditions> 
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
  </conditions> 
  <action type="Redirect" redirectType="Permanent" url="{R:1}/" /> 
</rule>

Canonical Tags

This is a topic mentioned in greater detail in another article specific to canonical tags but for the purpose of this article; adding a canonical tag to every page of the site (following the guide above) will prevent most duplicate content issues on any site.

This solution will resolve the issue but will not alow the duplicate page lto rank for the content posted on it. It will however pass on any authority that the page may have to the canonical page.

Benefit of Resolving

Controlling the URL’s from which your site & pages can be accessed prevents the potential impact from duplicate content issues.

Sign Up For Early Access
& Earn a Chance to Win 1 Years Free Subscription!

What You Get...

There's no obligation to become a full member after your trial, but we think that once you've seen what's available, you'll want to join us.

We are in the process of building our software and are ramping up to launch the Technical Auditing component in early 2018, soon to be followed by a suite of other components such as keyword ranking and backlink analysis.

Sign up today for 1 months free access and get a further 10% off of any package price when we launch for the first year as a reward for being an early subscriber.

Also, you will be entered into a lottery, where we will be giving away five 1-year subscriptions for free!

Sign up for early access today!