Improve Website SEO & Navigation with Friendly URLS - CMS Friendly URL

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. Enable Friendly URLs

In the admin area go to settings and go to the friendly urls page. Click the enable friendly urls button. When enabled the CMS will generate friendly URLs using the URL slugs that you specify on your categories, articles and products.

2. Setup URL Rewrite Rules

How to setup URL rewrite rules will depend on your server setup. Some servers and hosting control panels will provide an option or area in the control panel where you can add rewrite rules and other directives. For Linux web servers running Apache Web Server software you can also use a .htaccess file which is included with the CMS install.

Using htaccess file on Linux / Apache Web Servers

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 htaccess 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

Windows / IIS web servers

If you are using an IIS web server you might instead need to import the rules from the htaccess file into IIS using the URL Rewrite option in your server's control panel. Note that IIS does not support Rewritebase so you may also need to remove this line if it is present when importing.

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 /.

self-hosted cms
XT CMS