What is URL Structure?
URL structure refers to the appearance of your URL. In other words, it is what your URL looks like to humans and search engines. It is a Google ranking factor.
The URL structure consists of everything that makes up a URL. For example, the below URLs have different structures:
- https://yourdomain.com
- https://www.yourdomain.com
- https://yourdomain.com/exercises/yoga-for-moms
- https://yourdomain.com/t-shirts?color=blue&size=45
- https://www.yourdomain.com/t-shirts?color=blue&size=45
A good URL structure provides information about the webpage to the user and builds trust. It should also inform search engines about your site hierarchy and help them understand how your content is related to one another.
Parts of a URL structure
A URL can differ from site to site and from page to page. However, a URL will typically contain several parts, including:
- Protocol (HTTP or HTTPS)
- Domain name
- Top-level domain
- Second-level domain
- Subdomain
- Path
- Subdirectory
- URL slug
- URL parameter
- Port number
- Fragment
1 Protocol
The protocol, or scheme, specifies the method used to access the resource. It is commonly http:// and https://. However, some less common protocols include ftp://, sftp://, ftps://, file://, and mailto:.
2 Domain Name
The domain name is the human-readable address of a website. It consists of two or three parts, including the:
- Top-level domain
- Second-level domain
- Subdomain.
For example, yourdomain.org, example.net, and rankmath.com are domain names containing a second-level domain and a top-level domain.
Similarly, help.yourdomain.com and support.example.net are domain names containing a subdomain, second-level domain, and top-level domain.
3 Top-Level Domain (TLD)
The top-level domain is the last set of text in a domain name. It is the part that comes after the dot. Some common examples include .com, .net, .org, .co, .biz, .info, and .edu.
4 Second-Level Domain (SLD)
The second-level domain is the part of the domain name that comes immediately before the top-level domain. It is usually the name chosen by the website owner and is often the most memorable part of the URL. For example, yourdomain is the second-level domain in the URL https://yourdomain.com.
5 Subdomain
The subdomain is the prefix added to the beginning of a domain name. It is used to organize or navigate to different sections of the site. For example, blog.yourdomain.com, store.yourdomain.com, and support.yourdomain.com are all subdomains of yourdomain.com.
Www is also considered a subdomain, even though it was originally introduced to indicate that a particular server was serving webpages. So, www.yourdomain.com is also a subdomain of yourdomain.com.
6 Path
The path specifies the exact location of a file or resource. It consists of subdirectories and the URL slug. For example, /exercises/yoga-for-moms is the path in https://yourdomain.com/exercises/yoga-for-moms.
7 Subdirectory
A subdirectory or subfolder specifies the pathway to the file being viewed or accessed. They are a good indicator of a site’s URL hierarchy. For example, /exercises is the subdirectory in the URL https://yourdomain.com/exercises/yoga-for-new-moms.
Subdirectories typically end in forward slashes, while the file name does not end in a forward slash. So, technically:
- /colors/red should be the subdirectory in https://yourdomain.com/colors/red/
- /colors should be the subdirectory in https://yourdomain.com/colors/red
However, many bloggers and servers no longer follow this format. So, the forward slash is no longer a reliable method of differentiating between the subdirectory and file name in a path.
8 URL Slug
The URL slug or file name is the name of the file or resource that the URL leads to. This could be a webpage, image, or video. For example, /yoga-for-moms is the URL slug in https://yourdomain.com/exercises/yoga-for-moms.
9 URL Parameter
A URL parameter, query parameter, or query string refers to the letters, numbers, and symbols that pass additional information about a URL or modify the content of the webpage.
URL parameters begin with a question mark ?, followed by the key-value pair. For example, ?color=blue in the URL https://yourdomain.com/t-shirts?color=blue. color=blue is the key-value pair.
Multiple key-value pairs are separated with an ampersand &. For example, https://yourdomain.com/t-shirts?color=blue&size=large.
10 Port Number
The port number specifies the port used to access the resource on the server. If it is not included in the URL, then the default port for the protocol is used (e.g., 80 for HTTP and 443 for HTTPS).
The port number becomes after the domain name. It begins with a colon followed by some numbers. For example, :8080 in the URL http://yourdomain.com:8080/cakes/vanilla-cake
11 Fragment
The fragment is used to link to specific parts of a webpage. It is optional and will lead the visitor to a specific section on the site. For example, #team is the fragment in https://yourdomain.com/about-us#team.
URL Structure Best Practices
URLs are a Google ranking factor. To ensure your URLs are in order, you should pay attention to Google’s recommendations on creating and managing your URLs.
1 Use Descriptive URLs
Google recommends you use URLs that are readable and describe what the webpage or content is about. A human should be able to read and understand your URL. For example, https://yourdomain.com/yoga-tips-for-beginners
2 Use Hyphens to Separate Your URLs
Google recommends that you avoid using underscores in your URLs. Similarly, you should not join separate words together in your URLs. So, avoid creating URLs like https://yourdomain.com/vanilla_cake_recipe and https://yourdomain.com/vanillacakerecipe.
Instead, you should separate the words in your URLs using hyphens. For example, https://yourdomain.com/vanilla-cake-recipe.
3 Set Your URLs to the Same Case
Some URLs are case-sensitive. This means yourdomain.com/home, yourdomain.com/Home, and yourdomain.com/HOME can all lead to different parts of a website.
If your URL is not case-sensitive, Google recommends that you use the same lesser case in the URLs. In this case, it is best to stick with lowercase, as it is more common and leaves less room for ambiguity.
4 Use a Country Code Top-Level Domain
Google recommends you use a country code top-level domain (ccTLD) in URLs containing content targeted at audiences within a specific country or region. Google has confirmed that country code top-level domains offer you some SEO benefits when ranking for visitors from your target country.
So, a site targeting a French-speaking audience living in France should use the .fr country code top-level domain, such as https://yourdomain.fr.
Optionally, you can use country-specific subdirectories. For example, https://yourdomain.com/fr/. You may also use a subdomain, such as fr.yourdomain.com.
However, you should know that Google considers certain country code top-level domains like .co (Colombia), .ai (Anguilla), and .tv (Tuvalu) as generic top-level domains. In this case, these URLs will not offer you any SEO benefits when trying to rank in their respective countries.
That said, Google recommends that you avoid specifying the country of your target audience using a URL parameter like yourdomain.com?loc=de.
5 Include Local Words in the URL
Google recommends that you include words used in the region where your target audience resides. This could come in handy if you do local SEO and are trying to rank for local keywords.
For example, if your content targets a French-speaking audience living in France, use https://yourdomain.com/recette/riz instead of https://yourdomain.com/recipes/rice.
6 Use UTF-8 Encoding
Google recommends that you convert umlauts and emojis in your URLs using the UTF-8 encoding format. For example,
- Use
https://yourdomain.com/d%C3%BCsseldorf
instead of (whereü
is encoded as%C3%BC
) - Use
https://yourdomain.com/%F0%9F%98%83
where%F0%9F%98%83
is the UTF-8 encoding for the smiley face emoji 😃
7 Do Not Use Long ID Numbers
Google advises against using long ID numbers in your URL. For example, https://www.yourdomain.com/index.php?id_sezione=360&sid=3a5ebc944f41ddaa6f849f730f1
8 Do Not Use Fragments in the URL
Google recommends that you avoid using fragments in your URL. For example, https://example.com/home/#/section2.
9 Block Google From Crawling Problematic URLs
Google recommends that you update your robots.txt file to block Googlebot from crawling problematic URLs. These include certain dynamic URLs that can create infinite numbers of pages, such as URLs created by calendars or through your site’s search feature.
In both cases, you should consider blocking the URLs using regex expressions. You can refer to this guide on creating regex expressions.
10 Set Calendars URLs to Nofollow
If your site contains an infinite calendar that can dynamically create new URLs, Google recommends that you include a nofollow link attribute to such links.
11 Avoid Including Session IDs in Your URLs
Some sites use session IDs to manage user interactions. Google advises against this practice and recommends using cookies instead.
12 Fix Your Broken Relative Links
Many webmasters and bloggers make use of relative links when setting up their sites or for resources uploaded to their sites. These sorts of links can lead to the creation of endless links when broken.
So, Google recommends that you frequently review your site for broken relative links and fix them right away.
13 Remove Unnecessary Parameters
Many links contain parameters that are not very helpful. For example, many URLs contain referral parameters that help the blogger identify the source of the traffic. Google recommends that you trim your URLs and remove these parameters.
Many other URLs also contain parameters that point to identical or even the same content. This could cause Googlebot to use up more bandwidth than it ordinarily should. Sometimes, it may even cause Google to leave some of your content uncrawled and unindexed.
14 Use Key-Value Pairs in Your Parameter
If your URL contains a parameter, Google recommends that you use key-value pairs. So, avoid using the value without including the key. For example, https://yourdomain.com/yoga-mat?red.
Instead, ensure your dynamic URLs always contain the key-value pair, such as https//yourdomain.com/yoga-mat?color=green.
15 Avoid Repeating Parameter Keys
Google recommends that you avoid repeating the same parameter keys in your URL. For example, this URL repeats the size key twice: https://yourdomain.com/yoga-mat?size=large&size=wide.
Instead of repeating parameters, include them as part of a single key-value pair and separate them with a comma. For example, https://yourdomain.com/yoga-mat?size=large,wide.
16 Ensure Your Product Variants Have Distinctive URLs
If you run an ecommerce store, Google understands that a single product page can contain products in multiple variants. For example, if you sell yoga mats, you may have the yoga mats in blue and red colors.
Google recommends that each product variant should have a separate URL. You can create these product variants using:
- Path segments, for example, yourdomain.com/yoga-mat/blue
- URL parameters, for example, yourdomain.com/yoga-mat?color=blue
If you create your product variant URL using a URL parameter, Google recommends that you set the URL without the parameter as the canonical URL. That is yourdomain.com/yoga-mat in this case.
17 Ensure Your Paginated Pages Have Unique URLs
Google recommends that each paginated page on your site should have its own distinct URL. This is important, as Google mentioned that paginated pages account for most URL errors.
A paginated page is a page that splits multiple datasets into several pages. For example, the numbers at the bottom of search results pages indicate the search results have been split into multiple pages. Each individual page is a paginated page.
Consequences of a Poor URL Structure
A poor URL structure can have consequences for your SEO. Specifically, it will lead to undiscovered content, inefficient site crawling, and potential server issues.
1 Content May Left Uncrawled
Google does not crawl all the URLs it encounters. So, when Google encounters two or more URLs it thinks contain the same content, it crawls just one and leaves the rest.
This is quite common with URLs containing fragments. For example, if Google encounters two URLs below, it will assume they lead to two different sections of the same page.
- https://yourdomain.com/about-us#team
- https://yourdomain.com/about-us#the-company
So, it will crawl only one and leave the other one uncrawled. If, however, the URLs contain different content, then Google will not crawl the other one. This means the content will not appear on search results pages.
2 Content May Be Crawled Multiple Times
While Google puts effort into identifying whether a URL leads to the same content, it cannot decode such from certain URLs. This is particularly common with dynamic URLs and URLs that lead to duplicate content.
For example, https://yourdomain.com/product/yoga-mat and https://yourdomain.com/product?sku=6789 may both lead to the same content. However, Google does not know this from just the URL and would have crawled the page before it found out.
As a result, Google will use up more bandwidth from your site. Depending on your server capacity, this could slow down the rate Google crawls your site and may cause Google not to crawl some pages you want on search results pages.
3 Content May Be Left Undiscovered
Google cannot discover all your content if your URLs keep changing or can be generated in infinite ways. This could happen if your URL contains some element that alters it at intervals, such as a timestamp.
For example, Google treats https://yourdomain.com/contact?now=12:01am and https://yourdomain.com/contact?now=12:02am as different URLs even though they contain the same content. In this case, the timestamp will create a separate URL for every minute of the day.