At the moment my joomla articles are using the alias in the urls, like that:


Now I need to add the title of the specific joomla article in my url, too. So I will have a better url regarding SEO:

So the new url should look like that:


Do I need to change something in joomlas' router or do I need to use javascript for that?

  • Thank you for joining JSE and posting your question. Could you please edit your question to include links on this topic that you found while researching? Did you visit the Joomla documentation? The Joomla Forum? An online tutorial? To have better long term success in this community, it is better to show that you have done some research before posting a question. Please take our tour and read How to Ask. Jul 10, 2022 at 22:24

2 Answers 2


It's questionable whether having the title in the URL will be of any help in terms of SEO. The alias is usually the SEF version of the title anyways. But to answer your question, existing URLs can be altered by adding custom routing rules. This can be done using a system plugin. The methods used for this are Joomla\CMS\Router\Router::attachBuildRule() and Joomla\CMS\Router\Router::attachParseRule().

There are build rules and parse rules, and they can be attached at different stages (defined by constants in Joomla\CMS\Router\Router class).

You would register these rules early in the plugin:

use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Router\Router;

public function onAfterInitialise()
    // Get the site router.
    $router = CMSApplication::getRouter('site');

    // Attch custom rules.
    $router->attachBuildRule([$this, 'preprocessBuild'], Router::PROCESS_BEFORE);
    $router->attachBuildRule([$this, 'postprocessBuild'], Router::PROCESS_DURING);
    $router->attachParseRule([$this, 'postprocessParse'], Router::PROCESS_AFTER);

Both build and parse rules are in form of callables which accept an instance of the router and the URI object:

use Joomla\CMS\Router\SiteRouter;
use Joomla\CMS\Uri\Uri;

public function preprocessBuild(SiteRouter $router, Uri $uri)
    // Your logic here.

Build rules are used when building a SEF URL from non-SEF URL. This is where you would append the title by manipulating the URI instance. But before that you would need to determine you are touching the correct URL. You would to do that based on query variables in the $uri.

Parse rules are used when resolving current SEF URLs to a set of input variables. Each path segment is resolved and then removed from the $uri. If a segment is remanining, Joomla considers this to be an invalid URL and throws a 404. In your case, you would need to check if the remaining title matches the title of the article with a given ID in the database and remove it if it does.


Joomla does not work like that. The Article Alias is a SEF (Search Engine Friendly) version of the Article Title, meaning that some difficult characters (like space) are converted to dashes.

If your title would be "This is a nice Example Article" and the alias "nice-example-article", then what URL would you like to have? "This is a nice Example Article" is not a SEF name. Spaces in URLs are converted to their HTML equivalent %20.

Using Joomla's Menu Manager, you could create URLs like: site.com/menu/menu-item-alias-for-category-blog/menu-item-alias-for-single-article

  1. Create a Menu Item of type Category Blog with Menu Item Alias "menu-item-alias-for-category-blog"
  2. Create a Menu Item of type Single Article, with Menu Item Alias "menu-item-alias-for-single-article" and Parent Menu Item the Category Blog item from above. That way the article will be visible in the menu as well.

Alternatively you could also create a structure like site.com/menu/menu-item-alias-for-category-blog/article-alias

  1. Create a Menu Item of type Category Blog with Menu Item Alias "menu-item-alias-for-category-blog"
  2. Enable the Modern Router in Joomla 3: In Content > Articles > Integration > URL Routing: Modern + Remove IDs from URLs: Yes. That way you don't have to add every Article as Child Menu Items to the Menu. The nice URLs are created. However, the Articles are not listed in the Menu.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.