Should my URL end with a slash (/) ?

Should my URL end with a slash (/) ?

Yellow Spoonbill

There is a lot of confusion about URLs. Sometimes they end with a /, other times what looks like a filename, and sometimes even a plain word. Often you see the same page no matter which you type in.

So which should you use? Or doesn’t it matter?

The short answer

The short answer is they are different, and you should use always the one that’s correct for your situation if you care about either the speed of your website or search engine optimisation.

If you are referring to a specific page, use the long version, It is the fastest and most reliable.

If you are specifying a default file in a folder (typically index.html or index.php), use the version with the folder name and a trailing /,

And when not specifying either folder or file, but rather the home page of the website, use the one with the trailing /,

Clearly, the trick is to know which is the right one when. Let’s consider each in turn. If we know the differences between them, it’s a lot easier to work out which one is the right one.

What are the options?

I am starting with this one because it is the easiest to understand.

By requesting this URL you’re telling the web server at that you’d like a file called index.html in the folder products.

If there is no index.html file in the products folder, the web server will respond with a 404 Not Found error.

In an example such as this, there is nothing special about the folder name products or the file named index.html, and it makes no difference whether we use http or https. Here are a few other examples:

The file index.php in the top folder of the web server at

The file shoes.aspx in the folder products in the folder shop on the web server at

On a typical web server this URL will give the same page as our previous example, but the mechanism is different. In fact, this URL is just a special case abbreviated form of our first example.

This URL is actually requesting the default file from the products folder on the web server. The name of the file depends on the web server settings. If your web server has been configured to consider dog.txt as the default file, and there is a file named dog.txt in the products folder, that is what will be shown. If the products folder does not contain a file named dog.txt, then the web server will instead signify a 404 Not Found error.

Of course, most web servers are not configured to expect dog.txt as the default file. The normal default file names include:

  • index.html

  • index.php

  • index.aspx

Therefore, on a typical web server, a request for will cause the web server on to look for any of index.html, index.php or index.aspx in the products folder. The first match found will be the one shown.

If none of the files in the products folder have a file name that matches one of the default file names, then the web server will return a 404 Not Found error.

This is why and will normally result in you seeing the same page.

In general it doesn’t matter which of these two you use, however the one without the filename is more flexible. The flexibility comes from the fact that your website might start off with index.html as its default file, but later you might switch to PHP and use index.php instead. If your links are to you don’t need to change anything, but if they are to you’ll need to change them all to

It’s also shorter!

Of course, if the file you want does not have the default file name, you must specify the full name. Which means a URL more like our first example. Once again, some examples:

The file with the default filename (for example, index.html or index.php) in the top folder of the web server at

The file with the default filename in the folder products in the folder shop on the web server at If the only file in the products folder is shoes.aspx, then requesting this URL will result in a 404 Not Found error.

Now we start to move into the more complicated URL variations.

This URL may end up showing you the index.html file in the products folder. But that is not what you are asking for. You are actually requesting a file named products in the top folder of the web server at

Modern web servers try to be friendly and helpful. When asked for a file that doesn’t exist, they check to see if there’s a folder with the same name. If there is, the web server sends back a message (technically a 301 redirect) saying "try instead". Your web browser receives that instruction and tries again with the / on the end.

Now we are in a situation we have already covered. In response to this second request, this time for, the web server looks in the products folder for a file with a default filename and returns it if found.

This means there are (at least) three different URLs that can give the same final result. That is why people find the different options confusing. However the mechanism is different, and that is why understanding it matters. Assuming our web server has a file named index.html in the products folder:

Responds immediately with the index.html file in the products folder.

Responds immediately with the first file found in the products folder that has a default filename. In this example, that will be index.html.

First responds with some advice, which causes the web browser to send a second request. Responds immediately to the second request with the first file found in the products folder that has a default filename. In this example, that will be index.html.

I hope you can see that you never want to use URLs such as, where products is a folder. Doing so makes your web server work harder, and more importantly slows down the web page’s response time. This last point is particularly important on mobile. Having a mobile send two requests when one will do is not a good experience for your website visitors.

If you care about is SEO, then it is also important not to use this type of URL. When a search engine is ready to crawl your website, it allocates a certain budget to the crawl. When that budget is gone, the search engine will move on to the next website, whether or not yours is complete. The way the budget is probably allocated and used is not really relevant at this point, however you can safely assume that having to use two requests to access one page will use up that limited budget more quickly.

If you’ve followed everything so far, you may have noticed a theme starting. If so, you can probably guess what our next example URL actually means.

Although I haven’t specifically said so previously, the / on the end really means look for a default file in this folder. So this example is requesting any file with a default file name in the folderindex.html in the folder products.

If the products folder really does contain a folder named index.html, which in turn contains a file with a default file name such as index.html, then this request will actually return that file.

More commonly however this URL will result in a 404 Not Found error. Now you know why.

Think about this one for a moment, in light of what we’ve already covered. It’s probably the easiest to understand. Ends with a /, so you might guess the web server will look for a file with a default file name. And you’d be right.

Responds with the first found file with a default file name (such as index.html) in the top folder of the web server.

I’ve included this one because it is a special case. It doesn’t end in a /, so you’d think it would either

  1. refer to a specific file, returning a 404 Not Found if there was no match, or

  2. result in two requests, the second successful one being to

In reality, these outcomes do sometimes occur. It depends on the software making the request.

Once upon a time, a request to did indeed result in an error or a second request, depending on the web server, because there is no file or folder specified. Of course, we are mostly lazy, and typing that extra / was just too much work.

So web browsers learnt to recognise this special case. If you ask your web browser to fetch, it will ignore your instruction and instead request No error (assuming that website does exist) and no second request.

Despite this I recommend you always include the trailing / when adding any clickable link. While it will make no difference to most mainstream users, there is always the chance it will not work for a specific browser or software visitor.

My CMS doesn’t care which I use

So far I’ve been discussing what a web server, such as Apache or Nginx, will do assuming they use a typical configuration.

Many Content Management Systems (CMS), such as WordPress and Drupal, don’t seem to follow the concept of folders and files. and give the same result, while gives an error. The CMS replaces the web server’s default behaviour.

You might therefore think it makes no difference which you use, as long as the right content displays. But you’d be wrong.

What actually happens depends on the way the CMS is configured. There are two possibilities.

The CMS redirects

In my experience, this is the most common setting.

Immediately displays the desired content.

Just like our earlier example, this request causes the CMS to respond with advice to request instead, resulting in two requests.

Occasionally I have seen these two reversed. Usually you can work out which way your CMS is configured by requesting each one in turn, and when the page loads look at the address bar in your browser to see which version you ended up with.

Once you know which scheme your CMS uses, make sure all internal links are consistent with that scheme.

The CMS genuinely accepts either

Sometimes a CMS may be configured to respond with the same content for each URL, without any redirect.

You can spot this using your web browser. Type in each URL in turn, and check the address displayed in the address bar once the page loads. If both URL versions result in a page with the URL as you typed it in (i.e. neither of them redirects), then your CMS is accepting either.

This is not an problem for visitors to your website. There is no obvious speed or similar disadvantage for mobile users. However I advise you to reconfigure your CMS anyway to use a redirect, as described under The CMS redirects.

The redirect-based option is much better for your website’s Search Engine Optimisation (SEO). A search engine will see the two URLs as two different URLs, and assume they are therefore different pages. This raises several potential problems:

  • fetching the same content twice wastes your crawl budget.

  • there’s a risk a search engine will interpret the apparent duplicate pages as duplicate content designed to manipulate search rankings

  • if the search engine does not penalise the website for duplicate content, you’ve got two pages directly competing with each other

Conclusion - which should you use?

The simple answer is "the one that’s right for your situation". If you are specifying a specific, non-default page, use the first form, It is the fastest and most reliable.

If you are specifying a default file in a folder, use the version with the trailing /,

And when not specifying either folder or file, but rather the home page of the website, use the one with the trailing /,

For a CMS, check to see which your CMS is configured to prefer, and use that.

By ensuring you always use the most efficient URL, your website will be faster on mobile and you’ll stop wasting your search engine crawl budget.

Author: Anne Jessel

Categories: seourlsredirectsmobile