Share via:

About Dots in the Path of URLs

Why I finally decided to allow dots in URLs on- and in Beamtic's projects.


Edited: 2018-10-14 11:42

From a technical standpoint, there is nothing preventing us from using dots (.) in URLs. However, from a usability / logical standpoint this may be something that we should consider.

Dots in the URL might not make much sense to novice users who already has a hard time understanding the concept of an URL. We, developers, can do much to improve peoples understanding and normalize URLs to a point where they make sense to even novice users. The fact that most of the web does things in illogical and ugly ways does not excuse us from not doing better on our own sites. For instance, this is why I personally avoid using a slash "/" at the end of article URLs, based on the idea that the slash would indicate a directory. The logic continues for the dot, because the dot, at least at the end, would indicate a file extension. However, on the world wide web, this is not always the case.

We can choose to go two routes. Either we accept that the URL is basically different from a normal file system path, and therefor can contain all sorts of characters. Or, we can try to apply some logic. In my mind, it does not really matter what logic we apply, as long as search engines are able to follow, and our users will benefit from seeing clean URLs that are easy to share.

The need to use dots in URL paths

I write this because I personally have a real need to use dots in URLs. However, I also realize that doing so would violate my own URL logic. My need may not be limited to just using dots, but also other special characters. The plus sign is another special character which is being used both in C++ and in Google+, and that might actually cause worse problems than dot (.). Indeed, certain software and web standards, both topics I write about on Beamtic, include a dot in the name. I personally prefer people not to use special characters when naming things, because it might cause problems when people need to talk about the product. I still hope these will eventually get fixed, but in the meantime, I really think people should avoid dots, plusses, and other special characters.

The free image editor Paint.NET is a good example of software that includes a dot in the name. I think it is clear what the thought behind is. The developer likely thought something along the lines of: "I am writing this in .NET, so i will name it Paint.NET". It is a good example of how developers sometimes put very little thought into the marketing part of their creations. In Paint.NET's case, writing about the program on social media will actually, sometimes, cause the platform to incorrectly recognize the name as a link, and even apply an anchor to it automatically. I think Instagram fixed the problem, but both Facebook and Twitter still struggles with this bug (as of November 2017).

Another example would be the robots.txt standard. This standard does not even have a name in my eyes. They simply choose to call it robots.txt. Not thinking about the issues the dot might cause.

In any case, writing about both will cause dilemmas for me. For a long time, I choose to write DOT in caps instead, disallowing literal dot in URLs. But this is not ideal. If the word before the dot is itself also in caps, this could cause confusion, or in the least make it look bad or harder to read. So I have finally decided to just allow the use of dots, though I have still not implemented it in Beamtic's PHP Photo Gallery – but it will be allowed in my future projects. It is basically just a small modification to a regular expression anyway.

The good, the bad and the ugly

The good: I am less concerned about dots in directories I.e.: /some-directory/template-v1.4/ because the slash at the end will clearly show users that it is not a file. In other cases, this might also be logically clear. I.e: /some-directory/template-v1.4.css, and indeed I would have nothing against those cases.

The bad: But, if I were to write an article about robots.txt, and the URL would end up looking like /robots.txt, then this would clearly be a violation of my strict ideas on URL friendliness.

The ugly: Another possibility, which I would personally avoid, is to use an URL logic similar to this: /article/robots.txt. This would likely avoid confusion, but it can also be argued that the article/ part is wasting valuable space in the URL, which is especially important on mobile devices. Therefor, I baptise this "the ugly" :-D

As much as I dislike allowing dots in URLs in Beamtic's projects, I also see some potential benefits when it comes to search engines and users. As for the SEO benefits, if they even exist, they will be miniscule. So this alone would not be enough for me to violate my URL logic and start allowing it.

Usually it will be very clear that a given dot does not indicate a file extension. Most users will likely not get confused. And besides, any such confusion should quickly be cleared up when they view the contents of the URL.

I have, however, also seen some bad cases that were confusing, even to me. These had to do with sites that were actually linking to real files, and instead of linking directly to the static resource, they would link to some HTML version, but the URL would have .ext in it – this is not just ugly, it is bad. Do not do this!


Now you know the thoughts that went into the decision to finally allow them dots in URLs, and I have walked you through some specific cases, which I think totally justifies the use of dots in URLs.

I actually think it is mostly us, developers, who are overthinking things that are not even a problem in the first place. We need to consider the big picture when making these technical decisions, including the usability side of things.

Finally, some characters will need encoding when used in the URL. I would avoid allowing them to appear in URLs for this reason alone.