This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

πŸ“£ Join the live AMA session with Adam Silverstein on open source and WordPress core! Register Now β†’

Trailing Slashes in URLs – What is the Preferred Style?

Updated on March 14, 2019

3 Min Read

The The URL of a website carries a lot of information to improve user recall and increase the websites SERP standing. An important part of a URL structure is the trailing slash at the end. This slash is often used to differentiate between a directory and a file on the website.

Generally, users do not treat a URL with and without a trailing slash as two distinct elements. However, for search engines, the presence or absence of trailing slash makes a huge difference. For example:

https://www.abc.com/salescopy/ is crawled as a directory.

https://www.abc.com/salescopy is considered a file.

In addition to slashes, there are various other aspects that need to be considered while structuring the URLs. The main focus should be on enhancing the readability of the website’s address for both the target audience and search engine spiders. Webmasters can improve the URL structure either manually or through tools such as

Webmasters can improve the URL structure either manually or through tools such as friendly URL PrestaShop module, that automatically remove the special characters and makes sure that customers get to know the product or post’s name in no time.

What If I Add or Skip Trailing Slash?

The addition of a slash at the end of a URL instructs the web server to search for a directory. This speeds the web page loading because the server will retrieve the content of the web page without wasting time searching for the file.

On the other hand, when the server is asked to search for a web address with a slash, it searches for a file mentioned in the URL. If the server is unable to find the relevant file, it goes to the directory with the similar name and serves the files within. However, this usually results in the retrieval of an inappropriate web page or, worse,Β  a 404 Page Not Found error.

The problem arises in the case when the two URLs (with and without trailing slash) have different content. While Google treats the two URLs similarly and does not raise the question of duplicate content, this could be an issue for people who visit the website. It is often a surprise when the web page shows different content for URL with and without the trailing slash.

So, What’s the Preferred Option?

To avoid confusing customers with two different pages, it is often best to use a preferred version (either with or without the trailing slash) of the URL. Generally, website managers go with https://example.com/simple-directory/ rather than https://example.com/simple-directory. However, webmasters and store owners are free to opt for either version.

It is important to stick to the preferred version and enforce a common policy for all the URLs of the website, including those in the site map. To prevent showing multiple results to the visitors, set p redirections to the preferred URLs.

Trailing Slashes Are Not Recommended for Files

Experts still argue about whether to add the slash after the URLs that point to files on the web server.

With the trailing slash, the server assumes that the request is a directory and not a file. The result will either be a 404 Page Not Found error or a redirection to the proper URL version. However, this adds to the page load time. Thus, the best practice in this scenario is to skip the slash in the case of files to improve page load time.

Slashes in the Domain Names

The domain name without any file or directory suffix appears appealing without a slash at the end.

Compare

https://example.com/ with https://example.com

and decide which one you want to adopt for representing your online business.Β  For a domain name, you have the freedom to drive readers and target audience with a URL structure you prefer.

The URL structure of the website needs to be meaningful, readable and appealing so that the potential customers should feel at ease when browsing the store. The addition of a trailing slash may not affect the URL structure of the store significantly. However, you should consider the matter of duplicate URL structure seriously before finalizing the choice.


Author Bio

Alastair BrianΒ writer from “FMEModules”Β – a brand well known for top of the line reliable PrestaShop Add-ons, themes, extensions, and services. Follow him onΒ Twitter,Β LinkedIn.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Immad Uddin Khan

Immad is a Digital Content Producer for Cloudways - A Managed Cloud Hosting Platform. He is mostly busy in creating all sorts of informative and innovative content types. As a hobby, he loves to travel with his camera to picturesque destinations.

×

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!

×

Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Want to Experience the Cloudways Platform in Its Full Glory?

Take a FREE guided tour of Cloudways and see for yourself how easily you can manage your server & apps on the leading cloud-hosting platform.

Start my tour

CYBER WEEK SAVINGS

  • 0

    Days

  • 0

    Hours

  • 0

    Mints

  • 0

    Sec

GET OFFER

For 4 Months &
40 Free Migrations

For 4 Months &
40 Free Migrations

Upgrade Now