Remove category id and article id from Joomla URL

Posted in Tutorials

Tweet This Share on Facebook Bookmark on Delicious Digg this Submit to Reddit

I’m using Joomla 3.2.3.  And when I create an article within a category, it will automatically create an URL alias that looks like …

/index.php/8-python/1-python-if-else-statements

It has the number 8 for the category id and the “1” for the article id.

To remove the “8” from the category segment, you have to create a menu item to that category.   If you search the web for a solution, you will likely find hacks to Joomla code to fix this or plugins that you need to install (and sometimes pay for download).

But here is a way to get rid of these category and article ids with code hacks and without any plugins.  Note that I have Search Engine Friendly URL turned on and URL rewriting turned on.

Remove Category ID from Joomla URL

1.  Go to “Menus -> Main Menu” and click “New”

2.  Create the new menu with settings as shown …

create new menu in joomla

create new menu in joomla

3. If you refresh the site, the url to the article now becomes as shown below without the category id…

/index.php/python/1-python-if-else-statements

It appears that the old URL with the category id still works.

Remove Article ID from Joomla URL

To remove the article id from the URL, you have to create a menu item (possibly a hidden menu) to that article.  Then the link to the article becomes …

/python-if-else-statements

Hidden menu are often used in Joomla.  See this tutorial on how to set up a hidden menu.

Then add article to the hidden menu by going to “Menu -> Hidden Menu -> Add New Menu Item”.

For Menu Item Type, select “article -> single article”.  And set rest of the settings as shown…

assign article to hidden menu

assign article to hidden menu