Website Design Adelaide - WebsiteToGo LogoWebsite Design Adelaide - WebsiteToGo LogoWebsite Design Adelaide - WebsiteToGo LogoWebsite Design Adelaide - WebsiteToGo Logo
  • About Us
  • Websites
  • Services
    • Website Design
    • Complete Logo Design
    • Search Engine Optimisation
    • Facebook Marketing
    • Google Plus Management
    • Graphic Design
    • Internet Marketing Specialists
    • Newsletter Marketing
    • Smart Phone App Development
    • Website Optimisation
    • Website Templates
  • Logos
  • Domains/Products
  • Projects
  • Help
  • News
  • Contact
  • Login
✕

Creating a Custom 404 Page in Joomla

  • Home
  • Creating a Custom 404 Page in Joomla
Published by Jamber on August 24, 2017
Categories
Tags
    404 error

    If your template doesn’t come with a pre-configured error 404 page we highly recommend that you create one.  This is a pretty simple process.

    1. Go to article manager and create a new uncategorised article to act as your 404 page.  Commonly this will have a message saying “Sorry, the page you were looking for could not be found.”   You might also want to include a search widget for the site or some navigation or a fun image.  This can all be coded in the article.
    2. Create a menu link to the article – I often create a menu called hidden and place it in that.  Take the link code from that article and copy it to notepad for later.
    3. Copy the error.php from the Templates/System directory to the directoryt of the template that is in use.
    4. Modify the error.php code to redirect 404 errors to the 404 article you created.
      • look for this code:
      • if (!isset($this->error))
        {
        $this->error = JError::raiseWarning(404, JText::_(‘JERROR_ALERTNOAUTHOR’));
        $this->debug = false;
        }
      • replace with this code:
      • if (($this->error->getCode()) == ‘404’) {
        header(‘Location: index.php?option=com_content&view=article&id=43‘);
        exit;
        } 
      • substitute the Location: link for the URL from the article that you created.

    After you finish test that the site is working properly and test to ensure a failure url redirects properly.

    You can then go into the robots.txt file located in the root directory and add the following line:

    Disallow: /index.php?option=com_content&view=article&id=43

    Replacing the /index.php?…. with the 404 article url.

    Quick Links

    • Register a Domain
    • Renew Your Domain
    • Transfer a Domain
    • Australian Website Hosting
    • Email Hosting
    • SSL Certificates
    • Email Spam and Malware Protection
    • Themeforest Templates
    • Privacy Policy
    • Sitemap
    • Contact
    • Support

    Latest News

    • Roe Financial
    • WindSup
    • Whyalla Basketball Association
    • Transforma Croquet Mallets
    • Tono Constructions

    Get in Touch With Us

    PHONE: 0413 625 583
    Email: [email protected] 

    Adelaide: WebsiteToGo Pty Ltd PO Box 431, Hove SA 5048

    Port Noarlunga: 71 Esplanade, Port Noarlunga
    please book an appointment.

    Stay Connected

    • Facebook
    • Twitter
    • Google
    • Instagram
    • Pinterest
    © 2024 Websitetogo.com.au. All Rights Reserved.