Check out the ”US eCommerce technical SEO status” report from Boostsite!

SEO friendly URLs

URLs optimization for SEO

The website should be designed to be transparent and easy to understand for both users and search engine robots. One of the elements that should be optimized are URLs. A short and simple URL is much easier to remember, helps to navigate and looks better, which increases credibility more than a long and incomprehensible link. Properly built URLs will help to avoid indexing problems. It affects the click-through rate and the probability of noticing it in SERP. Of course, it is not as visible as the page title, but inputting the correct key phrases in the link is just as important.

What is a URL

First of all, let’s understand what URL actually is. The website URL is nothing more than what you see in the address bar of your web browser, for example:

https://boostsite.com/blog/what-is-lazy-loading/

URL consists of:

  • A protocol: https://
  • Domain name: boostsite.com
  • Document path: /blog/what-is-lazy-loading/
  • And with additional parameters & values that can be there as an option, for example UTMs: ?utm_source=google&utm_medium=organic

The acronym is an extension of the Uniform Resource Locator. This means a unified format for addressing information, data and services used on the Internet and in local networks. It also defines how the resource will be retrieved from the server. URL is a special case of URI, or Uniform Resource Identifier, which is used only to identify a resource, from web pages to files on disk. The URL, on the other hand, shows only the web address from which the file can be downloaded.

SEO friendly URLs

Friendly links consist of logical strings or refer to the parent category and indicate where on the page the user is at a given moment. So URLs structure can represent the hierarchy of pages on the website. Let’s use the following example:
Good URL structure

http://www.example-shop.com/phones/android/

Bad URL structure

http://www.example-shop.com/e9a2.aspx?id=14&ep

In a “good URL structure” example it is quite obvious that the user is browsing a category of phones that use the Android system. The “bad URL structure” example tells You nothing at all. There are several conditions to be met, to consider a URL an SEO friendly URL:

  • No variables, parameters, numbers – You should avoid any non meaningful numbers, additional parameters or variables that are necessary for a website to function properly.
  • Directory consistency – proper hierarchy of pages should be reflected in a URL structure. According to numerous reports, the length of the URL correlates with the position in SERP, so it is better to avoid long names of directories in the address, or eliminate this factor if you run a simple page with a small number of categories; without subcategories etc..
  • Keywords – URLs should contain keywords, it is a good habit to treat URLs as title tags & headlines, implementing Your SEO strategy in the same manner.
  • Uniqueness – URLs must be unique by definition. But additionally, You should avoid overlapping important keywords in the structure of your website – just as in title tags or headings.
  • Https and SSL certification – security is important for users and for Google and it directly affects the position of the page.Your website’s URL should begin with https://.
  • Implemented separators – the best method of separating individual words & keywords in URLs is to use dashes (“-“). By comparison, it is wrong to use underscores (“_”), which have no function and are not treated as a separator, thus concatenating several words into one.
  • Length – remember that the length of your URL should not be too long, it’s generally better to shorten it, resigning from unwanted words or phrases to emphasize relevant ones.
  • HTML file name – back in the days it was quite common to see the actual name of the HTML file, like index.html, in the URL. Today this is not a common practice & losing this extension can be an optimization practice that reduces the lengths of URL.
  • ASCII characters only – URLs should be created using characters from ASCII encoding system. Using other characters may create issues when indexing the page.

 

What are the benefits of SEO friendly links

Friendly URLs have a positive effect on SEO, as this aspect is considered a ranking factor by Google. Properly placing keywords that will direct the user to the content of a given subpage, will increase the visibility of these phrases in the search results and increase the chance of getting converting traffic. Google bots will appreciate friendly URLs while indexing the website as well.

Aside from the pure SEO benefits the user can get a glimpse of the info what the page content is about prior to clicking the link. This can have a positive impact on user experience & engagement with Your brand – better recognition & design.

How to create an SEO friendly URL structure

There are several ways to create a friendly link.

1. Plugins for CMS like WordPress

Most CMSes have some kind of URL control mechanisms already in place. The important thing is to use them properly, including all of the SEO rules mentioned above. As WordPress is by far the most popular content management system, here is the simple step-by-step guide to implementation of exemplary URL structure that will work well for SEO purposes:

  • Login to your WordPress dashboard.
  • Select Settings in the menu on the left hand side.
  • Click permalink settings.
  • Our recommendation is to select the Custom Structure option, to get the full control over displayed URLs.
SEO friendly URLs for WordPress CMS
WordPress SEO friendly URLs

Custom structure URL build schema will put all of the blog posts in https://boostsite.com/blog/ path and will be followed by post name.

2. Change address using rules mod_rewrite in .htaccess file

At the very beginning, we should start by entering into the .htaccess file the configuration directive that runs the mod_rewrite module:

RewriteEngine on

At this point, we can start inserting rules that create a friendly version of our URL. Some introductory examples:

RewriteEngine on
RewriteRule index.php$ index.html

The above code will make us go to domain.com/index.html after entering e.g. domain.com/index.php.
Why? RewriteRule is about rewriting the address. When we wrote above index.php$, it means that if after domain.com/ or domain.com/catalog/ there is index.php and nothing else. The $ sign is responsible for the end of respecting later, this will redirect us to domain.com/index.html.
The rule will work in this case, but in others, for example: domain.com/catalog/index.php?x=100 or domain.com/index.php?x=100, it will not work because index.php is followed by characters – in this case x = 100.

3. Removing a file extension from a URL

Now let’s move strictly to building a friendly version of the URL. Removal of .php, .html, .htm, or any other extensions can be done in the following way:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [R=301,L]

Short explanation: RewriteCond %{REQUEST_FILENAME} !-f and RewriteCond %{REQUEST_FILENAME} !-d checks that the address does not lead to a directory (-d) and that it leads to a file ending in .php (-f).
If the conditions are met, the rule will be executed to permanently replace a string with the suffix .php into a string with no extension.

4. Removing index.(php|html|html) from URL address

Often, after creating a page and entering an address in the browser, e.g. domain.com/index.html, we will not be transferred to an address without an index, which would be advisable.
This can be done in a very simple way:

RewriteRule^index.(Php|html|htm)$/[R=301,L]
RewriteRule^([a-z0-9 -_]+)/index.(Php|html|htm)$/$1/[R=301,L]

An explanation in this case I think is not necessary anymore, but for ordering – a short explanation: “If the address (after domain.com/ starts with a letter (or / i) digit and ends with / index. + Extension, redirect to this which starts with an address (before / index) and add the slash “/” to the end “.

5. Forcing a slash (“/”) at the end of a site address

To prevent a page from being available on two addresses (with and without a slash at the end), it would be a good idea to create a rule in .htaccess that will force the end of the slash to be added if it is not there.
RewriteRule^([a-z0-9 -_]+)$https://%{HTTP_HOST}/$1/[R=301]
Brief explanation: “If the address starts with a string that does not end with a slash ($ sign – no more respect for the rest) – redirect to https://domain.com/stringofcharacters/ (add slash at the end) with permanent carry.

6. Replace the variables from the url with the friendly version

RewriteRule^category/([a-z0-9 -_] +)/categories/article.php?name=$1[R=301]

The above code will make us have an available address in the form domain.com/category/stringofcharacters from an address in the form domain.com/categories/article.php?name=stringofcharacters thanks to the characters declared in parentheses being defined in code $ 1.
Similarly to this example, we can define further variables.
The parenthesis is the equivalent of a digit with a dollar sign, for example: (. *) (. *) Will be equivalent to $1 $2. Finally, a short example with two variables to illustrate the analogies of using “dollars”: address from domain.com/article.php?variable1=abc&variable2=cde to domain.com/article-abc-cde/:

RewriteRule^article-([a-z0-9-_] +)-([a-z0-9 -_]+)/$article.php?Variable1=$1&variable2=$2[R=301]

As you can see we have two parentheses on the left hand side which correspond to two “dollars” on the right hand side.

Don’t change Your URL structure too often

This is a quite important notice, especially for the websites that have already been indexed by Google. Rewriting the URL structure into an SEO friendly one may harm Your short term SEO if not done properly. Once Your website has been indexed, both old & new URL structures should be reflected in the 301 redirect matrix, to let the search engines know what has happened.
Remember that URLs are a very important part of Your online presence. Make sure that You will not change it too often. Make modifications only when it is absolutely necessary & prepare yourself thoroughly.

Leave a Comment

Boostsite Sp. z o.o.
ul. M. Bacciarellego 93
51-649 Wrocław, Poland

Home