Blog > Improve Website SEO & Navigation with Friendly URLS

Improve Website SEO & Navigation with Friendly URLS

30th July 2019 by Admin

What is a Friendly URL?

A Friendly URL is essentially a web page URL that does not end with a file extension. Friendly URLs typically consist of just words, forward slashes and hyphens to space words so they're more human readable and easier to remember. Friendly URLs are a great way to make navigation easier for your visitors and also improve website SEO. With XT-CMS it's easy to get Friendly URLs up and running on your website but first let's look at a comparison of the different URL types to get a better understanding.

CMS Friendly URL

Static URL vs Dynamic URL vs Friendly URL

Let's have a look at examples of what these different types of URL look like. The first example URL below is for a contact page which most websites will have and the second is for a fictitious product page.

Static URLs:

https://www.xt-cms.com/contact.htm
https://www.xt-cms.com/mens-shiny-shoes-product.htm

CMS Dynamic URLs:

https://www.xt-cms.com/?cat=1305065439329
https://www.xt-cms.com/?product=1205032439754

CMS Friendly URLs:

https://www.xt-cms.com/contact/
https://www.xt-cms.com/shop/clothing/mens/footwear/cool-shiny-shoes/

Now we don't sell cool shiny shoes but do you see the difference? By using Friendly URLs with the CMS you can create easy to read URLs that can also include parent categories. This gives your website a meaningful hierarchy that makes both visitors and search engines happy.

Now static URLs aren't really all that bad for a small website but Friendly URLs are more desirable especially for bigger websites with a blog or product catalog.


Enabling Friendly URLs

By default XT-CMS uses dynamic URLs to generate links and serve pages automatically through a single index.php file which is usually put in the wesbsite's root directory. When Friendly URLs are enabled the CMS still uses dynamic URLs as a safe fallback.

To enable Friendly URLs using XT-CMS is easy:

1. Edit CMS config file

Go to scripts/config.php in the cms folder and set friendly_urls to 1. This will let CMS know to generate Friendly URLs using the URL slugs that you specify on your categories, articles and products.

2. Setup htaccess file

Move the friendlyurl_fast.htaccess file to the folder where the main index.php is located, this is usually your website's root directory. The file then needs to be renamed to .htaccess for it to work.

If you are using the CMS for your whole website (which is the most common scenario) then you will need to put the htaccess file into your website's root folder along side the main index.php file. The htaccess file is setup by default to work from the website's root directory.

If you are running the cms in a sub directory for only a section of your website then you need to leave the hataccess file where it is along side the main index.php file. You will need to edit the htaccess file in this situation and insert your cms directory path into the rewrite rule:

RewriteRule . /mycmsdirectory/index.php

3. Set URL Slugs

When adding or editing a category, article or product you can specify a URL slug. If you don't specify a URL slug on a particular page the CMS will fall back to using a dynamic URL instead for that particular page. It's ok to have some pages using dynamic URLs and others using Friendly URLs if you want to. For the home page URL slug you should use a single forward slash /.

XT CMS