Categories
Joomla

How to fix Fatal error: Class ‘ContentHelperRoute’ not found ?

If you get the error after publishing a module/component into your joomla website, then here is an easy fix to it. Add the following code to the file below

Steps to fix Class ‘ContentHelperRoute’ not found Error

  • Open the file in which you see the error using a text editor.
  • Search for the following code
     defined( '_JEXEC' ) or die( 'Direct Access to this location is not allowed.');
  • For Joomla 2.5.x add this code
    require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
    if(!class_exists('ContentHelperRoute')) require_once (JPATH_SITE . '/components/com_content/helpers/route.php');
  • For Joomla 3.x.x add the following
    if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR);
    require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
    if(!class_exists('ContentHelperRoute')) require_once (JPATH_SITE . '/components/com_content/helpers/route.php');
  • Save the file after adding the codes and you are done!

If you still face issues with fixing the issue, then feel free to contact us. Our technical team will assist you in fixing the issue.