SEO Blog

Trailing Slash or no Trailing Slash?

Spot the difference:

  • www.mywebsite.com/my-page/
  • www.mywebsite.com/my-page

Did you know that Google considers these two URLs completely different pages?

 

Even if they have exactly the same content, that slash at the end – called a trailing slash – makes it a different URL. That means, if both forms of the URL are active on your website, you risk splitting traffic and suffering duplicate content issues. These are both bad for SEO and can result in your website ranking at a lower position than it otherwise could.

How to check your URLs for a trailing slash

Whether or not your website uses a trailing slash isn’t important. Neither option is better than other. However, what is important is that you only use one OR the other.

 

Check if this is an issue on your website with the following steps (video below to demonstrate):

  1. Go to any page on your website (except the homepage)
  2. Take a look at the URL. Is there a trailing slash at the end of it?
  3. If there is, delete it and hit enter. If there isn’t, add one and hit enter.
  4. Once the page is reloaded, look at the URL again. Is the slash there or not?
  5. If the URL in stage 4 is the same as the URL in stage 2, then your page is automatically redirecting to one version of the URL. This is good and is what you want to happen.
  6. If the URL in stage 4 is DIFFERENT to the URL in stage 2, then your website has two different pages for the same content. This is bad and needs to be fixed.

How to fix duplicate pages caused by a trailing slash

Fixing this issue is only partly something you can do yourself, unless you want a lot of manual work. The following steps should be taken in partnership with a web developer.

Pick a format

It doesn’t matter whether your website uses a trailing slash or doesn’t. All that matters is that you pick one option and stick with it.

Update the .htaccess file

Unless you know exactly what you’re doing, editing your .htaccess file should be done by a developer. Code can be added to the file to force all URLs to redirect to a trailing slash or not.

The following code should be added to the appropriate section of your .htaccess file:

RewriteEngine on

# Include trailing slash on non-filepath urls
RewriteCond %{REQUEST_URI} !(.+)/$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*)$ https://yourwebsite.com/$1/ [R=301,L]

# Include trailing slash on directory
RewriteCond %{REQUEST_URI} !(.+)/$
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+)$ https:///yourwebsite.com/$1/ [R=301,L]

Manually add redirects

If you are unable to edit the .htaccess file, you will need to manually add redirects to every link. So that every trailing-slash URL goes to a non-trailing-slash URL (or vice versa). If you have only a few pages on your website, this shouldn’t take too long. However, if you have a lot of webpages, this will be a big task.

 

Remember, using this method, you will need to add a new redirect every time you create a new page.For common website builders like WordPress, you can add a plugin that makes it easy to add redirects. If your site is on another builder such as Wix or Weebly, check the help documents on how to do this. However, in most cases, these websites are already set up to avoid this issue, so you likely won’t come across it.

 

NOTE: Redirects aren’t required for files (e.g. images or PDFs) or for the homepage.

Update existing INTERNAL links

Check the existing links within your site to see which form of the URL they go to.

If you have set up redirects – either manually or via the .htaccess file code – then any incorrect links should automatically go to the correct format. However, it is still good practice to correct any redirecting links so that they go directly to the correct URL. A free tool such as Screaming Frog will help you identify these.

Update external links

You won’t have as much control over all external links that direct to your website. However, you should have them changed where possible. Your own profiles such as social media sites and Google Business Manager should be easy enough to change. Also check listing sites for instances where they use the wrong URL.

 

Search your business on Google and see what links come up. This will give you an idea of external sites that are linking to your own site.

 

If you can’t edit these existing sites yourself, try reaching out to the site owner asking them to make the update.

 

Ideally, all links will go to the correct version of the link, but if you can’t make the changes, don’t worry too much. As long as your redirects are working properly, they’ll be fine.

Create a process going forward

Make sure that anyone editing your website in the future knows which form of a link is to be used. Any new links added in the future should use this format.

Newsletter

Sign up to our newsletter for SEO tips, news, and offers.