1

Is it possible to set up a 404 page, and after x amount of time redirecting to the homepage?

{% extends "_layout/_layout" %}


{% set metaTitle = "404" %}


{% set bodyId           = "404" %}
{% set bodyClass        = "404" %}

{% block content %}
    <section class="container">
        <h1>Page not found</h1>

        <p>What’s worse, a hilarious 404 page can’t be found either.</p>
    </section>


    <!--404 Tracking Google-->
<script type="text/javascript">// <![CDATA[
    if (document.title.search(/404/i) !== -1) {
    _gaq.push(['_trackEvent', 'Error', '404', 'page: ' + document.location.pathname + document.location.search + ' ref: ' + document.referrer,,true]);
     }; 
    // ]]>

</script>
{% endblock %}
2

You could always use a meta refresh

<meta http-equiv="refresh" content="5; url=http://example.com/">

With the number being the amount of time in seconds until the redirect

|improve this answer|||||
  • damn off course! – Johannes Lamers Dec 13 '14 at 0:03
  • 1
    pay attention that the tag is broken: it should be content="5;url='whatever'" – Masiorama Nov 24 '15 at 15:34
  • good catch, feel free to edit answers when you see these errors :) – Alec Ritson Nov 24 '15 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.