There are many reasons why variables or technical parameters may appear in the URLs of our Website’s pages. Removing them is important for usability.
If you have a Website built with WordPress or any other CMS or you have dynamic pages where different contents can be shown depending on the variables introduced by the user (search forms, e-commerce…), even if we have hand-coded static pages created manually and we have forgotten to introduce the «index.html» files in folders, technical parameters can appear in the URLs.
WHAT ARE CLEAN URLs?
A clean or user-friendly URL is one which does not have variables or technical parameters, that has a clear navigation structure, easy to understand and which, preferably, includes relevant keywords.
Here we have a few examples of NON-FRIENDLY URLs:
http://www.my-website.com/index.php/en/
http://www.my-website.com/services.html
http://www.my-website.com/contact/index.php
http://www.my-website.com/products/index.php?q=143
http://www.my-website.com/blog/?p=172
And here are their FRIENDLY URLs alternatives:
http://www.my-website.com/en/
http://www.my-website.com/services/
http://www.my-website.com/contact/
http://www.my-website.com/products/product-name/
http://www.my-website.com/blog/post-title/
WHY ARE THEY IMPORTANT?
– Search engines can’t fill out forms in order to extract data from your Website, so contents that are shown after filling out forms are not indexed unless you link to them directly.
– It improves usability. Clean URLs are easy to remember if they don’t have technical parameters or variables and follow a logic folder structure in order to improve navigation and user experience.
– Inserting Keywords in the URL makes them be highlighted in the Google results page when a user makes a search which includes those terms, increasing your site’s visibility and its click-through rate.
HOW TO CREATE CLEAN URLs
The method to be applied depends mainly on how you have created your Website (hand-coded, with a CMS or a Framework).
1. If your Website has been created with a CMS it is very likely that it has an option to change the URLs. WordPress, for example, has this option under SETTINGS>PERMALINKS in the dashboard. From all the possible URL structures WordPress offers, we prefer the POST NAME and then tweaking the Permalink manually in the EDIT section of each post.
2. If your Website has been hand-coded and you have pages with a visible technical parameter ( .html, .php or alike) in their URL you can place the file in a folder with the same name and rename the file to index.html or index.php and placing it inside the folder.
For example:
http://www.my-website.com/services.html
We create a folder named /services/ in the root folder of our Website, we rename the services.html file to index.html and place it in the /services/ folder.
This way, when we navigate to http://www.my-website.com/services/ the same page will appear with a much more user-friendly URL.
3. The most advanced option which allows more control is editing the .htaccess file and establishing RewriteRules using REGEX expressions to modify the URLs. This option requires technical knowledges and is the best option if you have created your site using a Framework, although it also can be used for hand-coded and CMS sites.