SEO Friendly URL Part 2: Trailing Slash or Not

In a previous post, I showed you the SEO friendly URL structure for WordPress. Now you may wonder should I use a trailing slash for my URL? This tutorial will show you the ins and outs of trailing slash.

The Convention

The convention is that webmaster like to use a trailing slash to indicate a directory on their web server and do not use trailing slash when it denotes a file.

How To Remove Trailing Slash in WordPress

Go to your WordPress admin panel, then select Settings >Permalinks. In the Common Settings, select Custom Structure and enter the following in the text field:

/%postname%

or

/%category%/%postname%

Save your changes.

Using this method, the trailing slash of your category and tag URL will also be removed. If you want to preserve the slash of your category and tag URL and you are using the Yoast SEO plugin, then this can be done quite easily. In WordPress admin panel, go to SEO > Advanced > Permalinks, then put a checkmark in front of Enforce a trailing slash on all category and tag URL’s

What is WordPress’s Behavior About Trailing Slash?

If you choose to preserve the ending slash, then WordPress will redirect the no-trailing-slash URL to the URL with trailing slash. You can verify this by removing the ending slash of a URL and put it in the address bar of your browser. You can see it will be redirected. They serve the same content.

If you use Linux or Mac, you can type the following command in terminal:

curl -I http://www.yourdomain.com/your-awesome-post

You will get a 301 Moved Permanently response code. And at the bottom of the output you can find the location where the URL is redirected.

user@localhost ~] $ curl -I http://www.linuxbabe.com/wordpress/what-is-slug-in-wordpress
 HTTP/1.1 301 Moved Permanently
 Server: nginx/1.6.3
 Date: Wed, 18 Nov 2015 01:24:05 GMT
 Content-Type: text/html; charset=UTF-8
 Connection: keep-alive
 X-Powered-By: PHP/5.4.16
 X-Pingback: http://www.linuxbabe.com/xmlrpc.php
 X-UA-Compatible: IE=edge,chrome=1
 Location: http://www.linuxbabe.com/wordpress/what-is-slug-in-wordpress/

On the other hand, if you choose to remove the ending slash, then WordPress will redirect the URL with ending slash to the no-trailing-slash URL. You can verify this using the method mentioned above.

So you can be rest assured that whether people type the trailing slash or not, they will get to your web page.

Duplicate Content Issue

If your / and no-/ URL have the same content and WordPress redirect one URL to another, then you are good to go. Google will not define this as duplicate content.

Link Building

If you get a backlink with no slash at the end and also another backlink with trailing slash, would your PageRank be split? The answer is no. You PageRank will not be split. Google will combine those two different backlinks together in a good way so that your PageRank will not be split between the two.

What I’m Doing

I choose to remove the ending slash for my posts and pages. When people want to link to your article and they see a slash at the end, they are likely to be a little confused. Sometimes they left that out. Remove the trailing slash and no one will be confused. When you have a slash at the end of your URL, and people left that out, there will be a redirect. Redirecting slows down web pages and increase your server load.

Some say that WordPress by default have trailing slash and WordPress is the number one web publishing tool, so you should stick with the default format. Well, I disagree. Look at the default WordPress permalink structure! It’s not SEO friendly, you have to change it to something like postname or category/postname to make it search engine friendly. So you don’t have to stick with the default trailing slash either.

Additional Reading:

Rate this tutorial
[Total: 2 Average: 3]

Leave a Reply

Your email address will not be published. Required fields are marked *