URL configuration in Joomla
Creating easily understandable URLs is very important. If you look at a URL, you should be able to guess the subject of the page the URL is created for. Ideally, also the focus keyword for that particular page should be included in the URL. The URL is actually quite an important SEO parameter, so pay attention to this. In many CMSs, like Joomla, it is very important to choose a base configuration for your URL creation. Getting this right from the start is extremely important. Having to change this at a later stage can cause you all kinds of trouble. As an example: if you change the HTML-suffix in the Global Configuration from Yes to No, all your URLs will break, as the .html suffix will be stripped, while Google still has them indexed.
URLs in Joomla
When configured incorrectly, Joomla generates URLs that cannot be easily understood, like this example:
This is completely meaningless to both users and search engines of course, and it should be presented as something more readable, like this:
In earlier versions of Joomla, you had to manually adjust your settings to achieve this. Happily, this is not necessary anymore. Joomla ships with a much better base configuration. Still, though, there is a lot of tuning that can be done. First, always go to Global Configuration and check the Site and SEO settings:
The first parameter that you should always make sure is switched on is Search Engine Friendly URLs. This will achieve the readable URL's we just discussed, but luckily this is the default setting.
Secondly, we need to consider the Use URL Rewriting parameter. With this switched off (which is the default setting), your URLs are readable, but they still always start with /index.php/. Preferably, we should remove this as well: Set the parameter to Yes, and at the same time, rename the file htaccess.txt (in the root of your Joomla site) to .htaccess. This needs to be done at the same time. It only works on Apache servers, but 95% of the hosts run on these, so this should seldom be a problem. If you are using a local site on your Windows PC, you may notice that you cannot rename a file without an extension, so you should go to a DOS prompt in the correct folder and type:
rename htaccess.txt .htaccess
Thirdly, you have the possibility to add a suffix to your URLs, like .html. For SEO this is useless, so leave it off. The following 2 parameters do not affect URLs, but are still important:
Unicode Aliases should be better left untouched.
And finally, we have the Include Site name in Page Title's parameter. If you have a site name that makes sense for SEO, include it, either before or after the description. Also, be aware that having the site name included in the page title limits you in setting it up exactly as you want it: you have fewer characters (out of the allowed 60 or so), to make it unique. That is why I usually don't include it and only add it on pages where I really want it, like the homepage.
In Joomla 3, we had some base options for our URLs: URL Routing. You could choose between Modern and Legacy. But in Joomla 4, there is no need to choose, routing is done in a modern way by default.
However, we can still use the option Remove IDs from URLs (you can find it in the Articles overview Options, tab Integration) No explanation is needed I guess, it will do just that: remove the ID from items that are shown in Blog and List overviews. In the old situation, you could have a URL like this:
With ID's removed you get::
And your URLs are nice and clean!
URLs are based on Menu-item or Article title
Now that the base configuration is in place, we can look at how URLs for individual articles and menu items are generated:
- For menu items, the URL is built based on the alias of the actual item, which is appended to a possible parent menu item. So, if your menu item is called Business hours, with a parent menu item of Contact, the URL will become /contact/business-hours.
- For articles, it depends on whether they are linked to a menu item. If they are, the URL is based on this menu item. If not, the URL is based on the Item-ID of the article (if switched on) plus the actual Article-alias. As an example: if your article is called How to make soup, the URL could be something like /46-how-to-make-soup.
Knowing this, you can either tune your aliases for perfect URLs, but you can also customize your aliases, as the alias is used as the actual base for URLs.