Create Generic SEO-friendly URLs for better SEO

Divyesh Dhokiya
Saltside Engineering
4 min readMay 26, 2023
Generic SEO-friendly URLs for better SEO
Generic SEO-friendly URLs for better SEO — (Source: https://shorturl.at/btB89)

Introduction:

When it comes to optimizing our websites for SEO, we often come across the term “SEO-friendly URL.” While many of us are familiar with the concept, today we’ll talk about generic SEO-friendly URLs. By implementing these, we can take our website’s SEO to the next level and unlock even greater benefits by having more SEO-friendly URLs on the website.

Understanding SEO-friendly URLs:

Before we explore generic SEO-friendly URLs, let’s quickly refresh our understanding of SEO-friendly URLs. SEO-friendly URLs refer to a URL structure that is simple, concise, and user-friendly. They follow best practices to make URLs more readable and understandable for both search engines and human visitors.

Why does it even matter?

There are multiple reasons but I have listed some of them which are most important.

  1. Search Engine Interpretation
  2. Crawlability and Indexability
  3. Link Sharing and Backlink Anchor Text
  4. User Experience

Exploring Generic SEO-friendly URLs:

Now, let's dive deeper into the concept of generic SEO-friendly URLs using an example from Saltside.se, where I work. At Saltside, we utilize various filters and categories on our product SERP pages (ikman.lk, bikroy.com) and have tried to choose the right technical approach to implement SEO-friendly URLs from the start to maximize SEO benefits.

To illustrate, let’s consider the category cars and the filters brand, model, body type, and fuel type. Here is a live clean URL example along with an explanation of each parameter:

SEO-friendly URL: ikman.lk/en/ads/sri-lanka/cars/toyota/corolla

Explanation: domain/:locale/ads/:location/:category/:brand/:model

In the above URL, dynamic parameters (locale, location, category, brand, model) are included in specific sequences. This sequence is crucial for distinguishing the parameters from one another.

Now, assume we want to create an SEO-friendly URL only for the filter body type.

ikman.lk/en/ads/sri-lanka/cars/saloon

Problem: Technically, the above URL wouldn’t work as expected because the position at which we pass the body type value is already occupied by the brandfilter. Consequently, the URL assumes we’re passing the value for the brand filter instead of the body type.

To address this issue, we require a different technical approach to have distinguishers in the URLs that convey their intended meaning and allow us to use filter values correctly to fetch the desired data.

The question is, How can we do that?

Solution: There could be multiple technical approaches to achieve this, one of them is by adding unique static identifiers as parameters in the URL path. For instance:

ikman.lk/en/ads/b/sri-lanka/cars/saloon

In this example, we’ve added /b to the path. However, this approach becomes less scalable when dealing with multiple filter combinations.

To overcome this challenge, we’ve developed a generic solution: Generic SEO-friendly URLs.

Let’s understand how.

As mentioned earlier, we can use identifiers in the URL to differentiate them. This solves our initial problem. To scale this solution, we must maintain the sequence of parameters by using unique sequence identifiers as URL parameters.

Let me show you how.

ikman.lk/en/ads/s/06/sri-lanka/cars/saloon

ikman.lk/:locale/ads/s/:sequence/:location/:category/:dynamicParam1

/s is the distinguisher of the URL from other URLs.

/:sequence is the identifier that helps us understand the position of the dynamic parameters after the category.

To achieve this, we need to maintain mappings of the sequence key and filter type, as shown below:

{
06: "body_type"
}

With these mappings, we can determine.

the type of dynamic filter from the sequence key. For example:

ikman.lk/en/ads/s/06/sri-lanka/cars/saloon

In this case, 06 represents the body type. Therefore, whenever we encounter the sequence parameter value as 06, we can use the dynamic parameter value as the body type after the category parameter.

We can add more filters to the mapping and generate clean URLs accordingly. For instance, if we need SEO-friendly URLs for body type and fuel type,

First thing, update the mappings.

{
06: "body_type",

08: "enum.fuel_type"
}

The URL would be:

ikman.lk/en/ads/s/0608/sri-lanka/cars/saloon/petrol

and so on.

By using this technical approach, we can scale our solution and create SEO-friendly URLs using a generic method for any number of filters on the website.

Considerations:

While implementing this logic, keep the following points in mind:

  • Ensure the numeric sequence is in increasing order to prevent URL duplication.
  • Only allow the formation of URLs for existing mappings to avoid HTTP 404 errors.

Conclusion:

In conclusion, generic SEO-friendly URLs offer a valuable solution for enhancing SEO by having more SEO-friendly URLs for more filters, which eventually increase their presence on the internet and help improve overall SEO.

There could be various technical approaches to achieve the same or if any feedback we can discuss it in the comment section.

Thank you for reading!

References:

--

--