This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Ahmet
Ahmet

I want the 404 page redirect to the homepage after 5 seconds, for example. How can I do that?

{% do redirect('http://www.yoursite.com') %}

or

{% redirect "'home'|page" 301 %}

It did not work with the following codes. Redirect did not recognize it.

Last updated

mjauvin
mjauvin

You could use a placeholder in your layout <head> section and use this in your 404 page:

{% put meta %} 
   <meta http-equiv="refresh" content="5;url={{ 'home'|page }}" />
{% endput %}

ref. https://octobercms.com/docs/cms/layouts#placeholders

Last updated

mjauvin
mjauvin

Another more modern way is adding this JavaScript at the end of your 404 page markup:

    <script>
        setTimeout(function() {
            window.location.replace( {{ 'home'|page }} )
        }, 5000);
    </script>

Last updated

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.