This page short URL: qx8

All these settings are available under the Basic configuration tab of sh404SEF Error page configuration page.

Settings to alter behavior of sh404SEF 404 error page handling

Try to autoredirect 404s

If enabled (off by default), sh404SEF will automatically perform a 301 redirect from the 404 error to the most similar URLs it can find in the URL database. This will be useful in several situations:

  • when moving to Joomla! SEF URLs to sh404SEF, old URLs will not work any longer. As most likely both will share some keywords, sh404SEF should be able to perform good redirects in most cases
  • you have moved some content from one place (category) to another, and don't want or cannot setup 301 redirects by any means
  • Please note there's strictly no garantee as to the accuracy of the redirect target. It's based on keywords in both URLs, and so you should test on your own site before enabling this feature. Likewise, sh404SEF may be unable to find a similar URL, and will just display its 404 error page in such case.
  • At the moment, this feature does not operate if one or more extensions are set to Use Joomla! router under the By components tab of sh404SEF configuration.

Display error-message

When 404 auto-redirect is enabled, we advice to display a message to your users explaining that they are not viewing the original page. sh404SEF will build and display such message for you.

  • The redirect message is displayed using javascript injected into the target page, to avoid as much as possible indexing of the information displayed by search engines. Google will execute most javascript on a page, but it should not index and rank this message. If that started to happen on your site, you should disable the 404 redirect message.
  • Do NOT display a redirect message if you're using the Joomla! system cache plugin. If the target of the redirect is not already in the cache, it will be stored with the redirect message, and all visitors will see it, even if they have not been redirected

Here is what the default redirect message looks like:

User information message displayed after an automatic redirect

You can customize its appearance in 3 ways:

Visual appearance

In the above configuration window, you can select:

  • the text color
  • the background color
  • the background opacity

Displayed text

Making use of Joomla! language strings override, you can customize the text displayed to your liking. Here are the language keys to override:

  • COM_SH404SEF_404_AUTO_REDIRECT: main text. Can include the %s tag, which will be replaced with the original, 404 URL requested by user
  • COM_SH404SEF_404_AUTO_REDIRECT_ALTERNATIVES: additional text used when sh404SEF found more than one similar URLs to redirect to. It redirects to the most similar one, but additional URLs can be displayed to the user to let them pick their preferred one. You should include the {sh404sefSimilarUrls} tag in this string so that sh404SEF can replace it with those similar URLs.

Complete override

You can also use Joomla! JLayout override mechanism to entirely replace the look and feel of the 404 auto-redirect message. To achieve this, the layout to replace is identified as:

com_sh404sef.general.error_404_redirect_msg

It contains all PHP, CSS and javascript to display the message. You should override it by placing your own error_404_redirect_msg.php file in the /templates/<your_template/html/layouts/com_sh404sef/general folder. It will receive the following data:

$displayData['title'] string The popup title
$displayData['content'] string The page content, with similar URLs if any

404 error handling

You have 3 options there, which will decide how sh404SEF 404 error handling should be activated:

  • Only for sh404SEF pages: sh404SEF error handling will be used only for sh404SEF generated errors. Basically, only when an incoming request URL is not found in the database. If a non-sef URL is found, but later Joomla! or an extension doesn't find the associated content and triggers a 404, Joomla! regular 404 error page will be used
  • Override sh404SEF error page: sh404SEF 404 error handling should be use for all 404s
  • Use sh404SEF error page: sh404SEF 404 handling is disabled, and Joomla! regular 404 error display will be used

Itemid to use

As sh404SEF 404 error page is managed as a simple content article, it's actually displayed by Joomla! itself. Which means the choice of template to use and modules to display is based on a menu item. By default, sh404SEF will activate the home page menu item: it means that the template and modules associated with your home page will be used.

If this is not the desired behavior, you can select in that field a new menu item to use instead. You can select any existing menu item on your site, or even create one specifically to display sh404SEF 404 error page. The latter is usually not necessary, as many times you'll just want to use a regular template and modules set.

Sub-template

By default (when value is set to 'index', or empty), sh404sef will display the 'Page not found' error page using your regular Joomla! template file, in accordance with the Itemid setting above. However you may enter here the name of an alternate sub-template file. For instance, most template come with a 'component' sub-template, which is much simpler and does not display any module. Just enter 'component' instead of 'index', to start using it.

You can also provide your own sub-template. Create it - let's say you call it 'error404.php', then store it in your template main directory, alongside index.php and component.php. Don't forget to enter 'error404' (without the trailing '.php') here so that sh404sef use it.

Please be sure to check out our Error page handling video which shows default behavior and changing basic settings in just a few minutes