How to create an optimal URL? (Guide)
The URL (Uniform Resource Locator) indicates the exact location of a website and/or a file on the Internet. This address appears in the search engine results pages (SERP), has a particular form, and may affect your position in the search rankings.
Read our URL guide. You will learn what a URL is, its composition, the optimal length, and how to proceed in the creation of URL structure on the web.
What is a URL?
A URL is colloquially known as a web address. As we specified above, it refers to the location of a file on the Internet, and a “file” usually means a website. However, a URL is not only limited to websites, but any unique content on the Internet has it, i.e. PDFs, images, videos, etc.
With regard to URLs, domains and IP addresses are important. Domains arose out of the need for replacing unclear clusters of numbers in the form of IP addresses. IP addresses are not very practical for users, but the Internet communicates only through them. If you enter a web address into the browser, it searches for its IP address, e.g. 18.104.22.168, and finds it using a DNS server.
In order to transform user-friendly domain names into IP addresses and vice versa, DNS are essential. DNS are systems or servers, which we can compare to telephone directories. They include domain names and the IP addresses assigned to them. DNS eliminated the use of IP addresses for common Internet users.
How does browsing work?
In searching for a particular domain, the browser works as follows:
- The user enters a domain: the user may search for domain names or go to them using a link thanks to DNS, which assigns IP addresses to them.
- The server sends the website content: if the request is processed successfully (status code 200), the server sends all website data to the browser.
- The browser processes the website: The browser evaluates and processes the received data and transforms it into a Document Object Model (DOM). The DOM may also be visible when you right-click on a website and choose Inspect. The keyboard shortcut Ctrl + Shift + I works the same way.
- The website appears in the browser: If the browser processes all the necessary parts of the code to correctly display (render) the website, it’s time to surf through the content.
What is a URL composed of?
If we break down a URL, we can see that it’s composed of multiple parts – both mandatory and optional. Which is which?
In general, we can follow this pattern:
Let’s add this blog’s URL to the formula:
Lower case and upper case letters in URL
In our example, we have specified a combination of lower case and upper case letters. But does it really matter? It definitely does!
A protocol and domain may be written in any way, since they are case-insensitive. The browser evaluates the address www.visibility.sk in the same way as WWw.VISibiLiTy.sK. On the other hand, the part after the slash located behind the top-level domain is case-sensitive, so the address “www.visibility.sk/blog/” is not the same as “www.visibility.sk/Blog/”.
Parts of URLs, or even the whole address, may be case insensitive for certain servers. This is particularly the case for servers running on Microsoft technologies. These will evaluate upper case and lower case letters the same way. The starting point, however, must always be the assumption that URLs are case sensitive, because it’s not easy to estimate how a server will react or if it’s able to discover a typo.
Some services, such as URL shorteners, even rely on upper case and lower case letters and use them intentionally, and letter case substitution means a completely different URL. For this reason, Google usually indexes URLs in a case sensitive way, too, since even a small change (letter case) can mean different content. The slash at the end of the URL, referred to as a trailing slash, is also perceived in the same sensitive way.
Let’s break down the individual parts of a URL.
At the beginning of the URL is the protocol type. This part can be called the scheme. The protocol gives instructions to the browser on how to retrieve or handle information from the server.
In the past, HTTP used to be standard. Today, Google recommends that website owners replace it with a secured version, HTTPS. A secure certificate encrypts the information you enter on a website – passwords, credit card details, and more. Furthermore, since July 2018, Google Chrome displays HTTP websites as unsecured. This decreases your ranking and the trustworthiness of the website in the eyes of users.
An HTTP alternative may also be HTTP/2, which improves website performance and security, and makes communication between the browser and server more effective. You can only move to HTTP/2 if you have HTTPS.
A domain can be composed of three parts:
- Subdomain: This is an optional part that follows the protocol. Usually, you come across blog subdomains, like blog.example.sk. Technically, “www” is also considered a subdomain. The use of “www” before the domain name is not mandatory, but it must be taken into account that Google considers “visibility.sk” and “www.visibility.sk” to be 2 different websites and domains. From an SEO perspective, using or omitting “www” should not affect your position in the search rankings. If you decide to switch from “www” to “without www” or vice versa, we suggest permanently redirecting the original content through status code 301, so that search engines are not confused due to duplicate content.
- Second-level domain: This is the name of your website. Each domain has an assigned IP address.
- Top-level domain: Originally, the top-level domains defined the meaning of a website. The extension .com used to represent commercial purposes, .edu was intended for educational institutions, and .org was mainly used by non-profit organisations. Gradually, top-level domains linked to countries were created (e.g. .sk). The third group comprises sponsored domains under the supervision of private organisations (e.g. Google).
Path to file
The part after the domain is relatively variable and changes depending on how you navigate through individual subpages of the website. Here, we can find the names of folders, products or services, categories, or parameters, with which you search or filter the content on the website.
In the past, this path indicated the physical location of the given content on the web server. Today, this is set manually for the needs of users and search engines – we’ll come to that in a moment.
Principles of correct URL creation
When you know what a URL is composed of, you can cook one up yourself. These are the ingredients you’ll need:
During the development of search engine algorithms, the use of keywords changed. However, they are still relevant – also within URLs. If you deal with the creation of URLs for your website, you’re sure to have done a keyword analysis, so you know which phrases you want to target and which you find relevant. You can utilise and apply such knowledge here as well. Of course, the use of keywords must be natural.
It is necessary to avoid entering keywords “forcibly”. Imagine you sell whiskey. You definitely don’t want your URL to look like this:
Read it from a user perspective and choose a more natural way:
This URL sounds natural, is short, and the user has a clear idea what it is.
Regarding the use of keywords in the URL, don’t forget images. Many people upload images onto the server with their original file names, such as DSC25665.jpg and so on. To be a step closer to the notional SEO ideal, image file names should be descriptive, contain key phrases, and should not include diacritic marks, capital letters, or spaces.
The path to the file on the web should look like this:
A clear and, in particular, readable structure is closely linked to the previous point. Web content optimisation is no longer just for “tricking” search engines and thus ranking first place in SERP. Instead, the centre of gravity is moved to the people, and if they are satisfied with the content, the search engines appreciate it as well.
Readability is subjective, but, for example, if you transparently include a category of product/service into the URL, you are on the right path to a good structure. A user should intuitively and effortlessly read from the URL where they are on the website, or which content they are currently interacting with.
The reader clearly knows which category the page is in. In the sections below, we will discuss whether it is necessary to specify the category and how to create a URL for online shops and blogs.
A URL should be concise. You don’t have to copy exact headlines so that the user understands the website content. Omit non-functional words (conjunctions, articles, etc.).
Example: you’re creating a URL for an article titled: Comparison: American and Irish Whiskey. Which taste wins?
A URL to such an article should look like this: /blog/american-and-irish-whiskey-comparison/
The reader knows which section of the website they’re in and what the article will be about, and at the same time, the URL retains its optimal length and conciseness.
From the previous point, we can simply derive that shorter URLs are better. They are referenced more, may act as anchor text, and both the user and the search engine understand the structure of your website.
On the other hand, don’t shorten the URL if it results in a loss of meaning. If we work with the previous example, it would look like this: /blog/comparison-whiskey/. Which whiskey? What is being compared? That’s why we need to find a balance between length and meaning.
TIP: In SERP, the URL length limit is 512 pixels, which equals approximately 75 characters. You can verify it in this free tool from Mangools, for example.
A URL may contain dynamic parts, which change e.g. when using filters. The result can look like this:
We can surely agree that such an address is not attractive and we can hardly read anything out of it. Where possible, try to minimise the amount of dynamic parameters. Tools such as Mod Rewrite or URL Rewrite Module, may help you achieve this.
The reason you should avoid dynamic elements is simple. In fact, they violate everything we have just said. The structure is unclear, the user doesn’t know where the page is, and in addition, the address can be unnecessarily long.
Regarding crawling, neither Google nor other search engines have a problem with dynamic “features”, but from a UX and, partially, an SEO perspective, it’s better to avoid them. If possible, of course.
On the other hand, even in the world of SEO, settings are not just black and white. A long URL with dynamic parameters may even be useful for users. When? Imagine that you are searching for a holiday, or flight tickets from point A to point B. In this case, it is appropriate if the parameters in the URL change based on the filter, and this URL can be simply sent to your holiday “buddy”.
Do not forget that with filters, it is essential to set up canonisation well. Another option is to return the URL with the given parameters from crawling through robots.txt or to set the meta tag noindex.
Imagine that in your online whiskey shop, you have the option to filter individual drinks according to alphabetical order, price, production year, etc. Each individual filter would have a unique URL, but the content on the website would not change in principle, it would only rearrange. The search engine could evaluate this as duplicate content and your ranking could drop.
The way to effectively prevent this is canonisation. If you have multiple URLs with the same or very similar content, add the rel=“canonical” tag to the <head> section. There, you mark the URL which will be indexed. Such use is suitable in particular for the e-commerce sphere.
Canonisation can also be used where the same article is published on 2 or more websites. If all parties agree, it is suitable to apply the canonical tag to indicate the original content.
If you migrate to a new website, you will most likely use redirect, also known as status code 301. This code tells the search engine that you have permanently moved your content to a new website. And a new website can also mean a transfer from “example.sk” to “www.example.sk”, since these are two different websites for Google.
However, you should limit the number of redirects to one, or a maximum of two. This means that a redirect from website A to website B is absolutely fine. Also, it’s not a big mistake if you are redirected from website B to website C. However, a redirect from A directly to C would be a better alternative.
If there are too many of these “leaps”, the loading process can be slowed down or even fail. Avoid multiple redirects and you will prevent unnecessary trouble in the future.
After these comprehensive guidelines, we can sketch what the structure can look like. It’s necessary to count on the fact that this is a relatively individual matter, which depends on the structure, size, as well as the focus of your website.
Let’s say you have an online shop. A general structure could be as follows:
In our example with delicious whiskey, it would look like this:
An online shop can be tricky, because you usually have the option to filter products based on price, colour, size, etc. Thus, a part of your URL can change according to the filter and look like this:
Filtering products is closely related to canonisation, which we have discussed above. Here, it is necessary to keep in mind that not all filters should be canonised and that you should create unique landing pages to some of them with unique meta captions, H1 tag, descriptions, and other content. These landing pages will be duly indexed and thus searchable in Google.
Filters in the form of price or sorting according to various parameters (alphabetical order, according to price, etc.) do not have real searchability, therefore it is not necessary to create their own pages. On the other hand, there are filters which are often searched for – e.g. colours.
Among other things, a keyword analysis can help you discover what is worth canonising and what to create a landing page for. You can also rely on sales statistics. If you have a product and you know that there is a high demand for it, creating a landing page is worth considering. This supports its organic traffic.
A second variant is to keep the categories in the online shop, but to omit them from the URL with particular products. This way you achieve a shorter URL, but on the other hand, you lose the descriptive aspect a URL should fulfil.
Problematic structure creation occurs with larger websites, where there are more ways to approach them, and this also applies to URLs. If you have a large website with several categories and a deep structure, we definitely recommend implementing breadcrumbs. Their role is to improve orientation on the website and ease movement in selected categories. You can read more about them, for example in this long article from Search Engine Journal.
It is recommended that the breadcrumbs and website structure are independent of each other. If the online shop has a deep structure, you should ensure that it is visible in the navigation, but you can omit it in the URL. With large online shops, it often occurs that one product can be placed in multiple categories. This strengthens the need to remove categories from the URL. Consequently, you will be able to change the structure of categories much more easily in the future without affecting the URL, and you will save a lot of work with 301 redirects.
If you have a smaller online shop with products that fit solely into one category, you can specify them including the category in the URL, and this shouldn’t cause trouble in the future.
So that it’s not too easy, you also have to take into account the fact that in several content management systems, it’s impossible to set the product category. For example, in WordPress, which powers no less than 35 % of Internet content, the basic setting is /product/product-name.
Example of an omitted category in a URL:
Whatever model you use, it is essential to maintain a unified URL style. If you omit the product category, do it throughout the website. This is also true in the opposite case. The URL structure should primarily be as logical and simple as possible – like folders stored on a disk. The structure should copy a natural, human way of searching and navigation in the specific online shop.
If you have a blog, you can apply rules to the URLs that are very similar to those for online shops. With blogs which have a broad focus, categorisation is almost mandatory. However, it is not necessary to specify it in the URLs.
If you decide not to include blog categories in article URLs, the advantage is that you can simply modify the categories, while the article addresses remain unchanged. On the other hand, if you include the category in the article URL, you can better analyse its performance.
You can read more about the use of categories and tags within a blog in our article.
In comparison with online shops, the difference is that many websites create their blogs on a subdomain instead of in a subfolder.
- Blog on a subdomain: https://blog.qualitywhiskey.sk
- Blog in a subfolder: https://qualitywhiskey.sk/blog
There are many articles, discussions, and opinions relating to whether it is better to use a subdomain or a subfolder. Within the SEO community, there is a consensus that subfolders are better from an SEO perspective. On the other hand, you can use subdomains if your blog would be thematically very different from the product website. A great comparison of subdomains and subfolders can also be found in Whiteboard Friday by Moz.
URL and SEO – what is their relationship?
The relationship between these three-letter acronyms is really passionate, because URL is an important factor of On-Page SEO. A well-structured URL improves the following four attributes of your website:
- UX: A clear and transparent URL structure helps browsers evaluate the content of your website better. It’s also important that thanks to this, the user has a good idea what they will find on the website. Just like a title tag or meta description, the URL is also displayed in SERP and may be decisive in whether a user clicks on your website or not.
- Ranking: Although URLs do not have a significant share in page ranking in the search results, the use of a keyword can improve the position.
- Link building: A solid URL structure encourages people to share it. Thus, this increases traffic on your website or improves the link portfolio. If anchor text is absent, the URL serves as anchor text, and in such a case, you want it to be simple and good-looking.
- With well-structured URLs on a website, Google can better understand the relationships between individual subpages and their content and/or purpose.
So how to sum up the extensive research into the depths of URLs? As follows:
- Readability: URLs should reflect the given content. The search engine should understand them as well as the user. Avoid unnecessary words that do not change the meaning. To separate words, a hyphen (-) or an underscore (_) are most frequently used, and you can come across dots as well.
- Keywords: Use keywords, but moderately and, in particular, naturally.
- Uppercase/lowercase letters: We recommend using only lowercase letters for a unified URL structure.
- Restricted characters: It’s important that you don’t use diacritics, punctuation, and other restricted characters in the creation of URLs. Addresses containing diacritics or restricted characters are converted by the browsers into various “escape” characters. A URL may then contain clusters like %20, %7D, %2F, etc.
- Dynamic parameters: Avoid dynamic parameters as much as possible, because they violate the comprehensible address structure.
You can also read this article about how to register a domain, what to pay attention to during registration, and how to verify a domain before that.