404 redirect

Hello,

If I go to www.example.com/somewhere it ends up recording the url in GA and elsewhere rather than redirecting to e.g. www.example.com/404 - how do I correctly implement such behaviour?

Comments

  • Is the 404 page controlled by FUEL or outside of it? The .htaccess file is routing all requests that don't match folders and files on the server to the index.php which is then in charge of 404 error pages. If you don't want 404 errors to register in GA, then you can edit the fuel/application/views/errors/html/error_404.php

  • I currently have the design for the 404 page set in fuel/application/views/_layouts/404_error.php and this is pointed to inside fuel.

  • Do you have redirects setup in the fuel/application/config/redirects.php and if so, are the redirects 'passive' or 'aggressive' type redirects:
    http://docs.getfuelcms.com/general/redirects

  • This is what it shows in my redirects.php file:

    // The pages to redirect to regardless if it's found by FUEL.
    // WARNING: Run on every request.
    $config['aggressive_redirects'] = array();

    // The pages to redirect to only AFTER no page is found by FUEL
    $config['passive_redirects'] = array();

  • So you are you saying, if you get a 404 error in FUEL, you want it to redirect that traffic to a specific 404 page instead of displaying the 404 page itself? If so, in your 404_error.php template, add the redirect code at the top.

  • What I am basically saying is should anyone visit local.fuel.co.uk/somewhere this address should never be shown in the address bar upon page load - instead local.fuel.co.uk/404_error should be shown.

    If I add a meta refresh the page just reloads indefinitely. ^.^

  • The FUEL 404 error is meant to be shown for any URI path that doesn't exist and doesn't call a redirect to go to a specific 404_error page. If you are wanting it to go to a specific 404_error page that is rendered in FUEL, you will need to add the redirect code to the 404_error template (or in a meta refresh like it sounds like you did) and then create a separate /fuel/application/views/404_error.php page that handles the redirect.

  • Thank you, opted for using header() in php, more seo friendly than a mere meta refresh.

Sign In or Register to comment.