It actually makes sense. Bear with me for a minute.
A SEF URL is actually a URL which
does not exist on the server. That is to say, when you go to https://www.akeebabackup.com/support there is no folder or file called
support on our server. Normally the web server (Apache) would see that and return an HTTP 404 Not Found response.
However, I want this pretty and easy to remember URL to be equivalent to the ugly and difficult to remember URL https://www.akeebabackup.com/index.php?option=com_ats&Itemid=.... So, how can I convince my site to convert an invalid URL to something that is actually usable,
without exposing the ugly URL to the user?
Enter SEF URLs.
Joomla's SEF URLs (and WordPress permalinks, and Drupal's URLs, and... you get the idea) are actually a two-fold magic trick. The first part of the magic trick is telling Apache to redirect invalid URLs to a PHP script. The other part of the magic trick is some PHP code which tries to make sense of the invalid URL and do something useful with it.
The first part of the magic trick is something you do in the configuration of the web server. On an Apache server the simplest way to do that is through .htaccess files. Joomla! comes with the following code
in its proposed .htaccess file:
## Begin - Joomla! core SEF Section.
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
#
## End - Joomla! core SEF Section.
Read the comments (the lines beginning with #) to understand what it does. As you see, if it's something which would result in a 404 error it gets redirected to Joomla's index.php file.
The second part of the magic trick is Joomla's most powerful feature: the SEF router. It's actually a whole ecosystem of plugins. Assuming that you're using Joomla's built in SEF system, as opposed to something like sh404SEF, AceSEF and so on, the first bit of it lies in the System - SEF plugin. This plugin checks to see if any part of the SEF path (the thing after the first /) matches your menu structure. This lets Joomla determine two important things: the menu item ID (called Itemid in Joomla parlance) and the component which is meant to handle the request. If there are more SEF path parts not handled by the Joomla menu system the SEF router will look into the detected component's for a file called router.php (called the "component's SEF router") and ask it to handle the remaining parts. In the end of the day Joomla has converted the SEF URL into a set of keys and values which it can use to load a component and ask it to render a page. And that's how our /support URL ended up being a page generated by our ticket system component displayed to you.
But what happens when the System - SEF plugin cannot find a suitable menu item for the SEF URL you gave it, as it happens when you type junk in the URL? Well, no menu item is found so Joomla! thinks falls back to handling it as
content (articles). But there's no content (article) category by that name either, hence the built-in com_content component throws an error about a missing category.
I hope that shed some light into the magic that goes into handling your URL and explained why you see what you see :)
Nicholas K. Dionysopoulos
Lead Developer and Director
🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!