Tuesday, 31 August 2010 02:54

Problem with sh404sef built-in 404 error page - Invalid Argument Warning

Written by 

Problem: PHP warning messages when visiting the 404 error page in sh404sef

Warning: Invalid argument supplied for foreach() in /components/com_content/helpers/route.php on line 106
Warning: Invalid argument supplied for foreach() in /components/com_content/helpers/route.php on line 106
Warning: Invalid argument supplied for foreach() in /components/com_content/helpers/route.php on line 106

Bad karma : we can't find that page !

You asked for http://www.yoursite.com/page_name/, but despite our computers looking very hard, we could not find it. What happened ?

* the link you clicked to arrive here has a typo in it
* or somehow we removed that page, or gave it another name
* or, quite unlikely for sure, maybe you typed it yourself and there was a little mistake ?

Analysis: It looks like Joomla is giving us this error message because it is looking for an ItemID now for the 404 error page, which is set in the sh404sef configuration.  This gives us additional control over the error page now, as we have specified an ItemID, we can also specify which template and modules are going to show on this page.

Solution: Follow these steps

  1. Edit the "__404__" article (I removed the underscores from the article title and just hit save - this step is probably optional but I don't see the point in the underscores)
  2. Create a menu link to this "404" article (create a "hiddenmenu" if you don't already have one)
  3. Note the ItemID# of the menu link you just created in step 2
  4. Edit the sh404sef Error Page Configuration: Make sure you've chosen the correct "404" page from the drop-down and give the ItemID of your 404 menu link in place of the "0" they provide in the default configuration.
Read 1511 times

1 comment

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.