Skip to navigation

How To Get Rid Of Unwanted Auto-Generated Category Pages In Joomla! Without An Extension

Written by and published on

Joomla! has a feature that allows it to generate content for non-existing URLs, if those URLs conform to a certain standard. If you gave Joomla! a URL like, it would likely show a list of articles that belong to a category whose ID is 42.

For some sites this is a good thing, for others that want more control over the pages, less so. Even in the latter case this feature usually causes no problems, but in some situations URLs like this can pop up uninvited, and they can be difficult to get rid of once Google finds them.

Luckily, the fix is simple:

  1. Create a new template for com_content’s category view that is not used anywhere else
  2. Trigger 404 whenever this template is loaded
  3. Set this template as default for categories

Create A New Template

This is easy peasy:

defined( '_JEXEC' ) or die( 'In an amusing way.' );
throw new Exception( 'Page not found', 404 );

Joomla! handles an exception with a 404 error code as a page not found error, so that’s all we need. Just copy it to /templates/your_template/html/com_content/category/ directory. You can name it however you like; notfound.php or something equally descriptive is probably a good idea.


Do not use underscores in the filename. They have a special meaning in Joomla! template filenames and cannot be used in this case.

Set Default Template For Category View

Go to SystemGlobal ConfigurationArticles and select the Category tab. If you have copied the template file to the override directory, it should be listed in the “Choose a layout” select field. Select it and save the settings.

Now if you try to open a URL that previously showed a list of articles in a certain category, you should get a “Page not found” error instead.


Commenting has been disabled until I get a proper spam protection working. =(

External Links

Back to beginning