Forums

Timed Redirect (5 posts)

  1. thewaves
    Member
    Posted 6 months ago #

    Hi all,

    I have a question about timed redirects.

    we have setup a site using the free Woothemes placeholder theme, it is very limited but that is OK - the site is simple.

    After 20 seconds I would like the page to redirect to another URL - would it be possible to insert some code into footer.php to do this?

  2. thewaves
    Member
    Posted 6 months ago #

    I have found what looks like the right code:

    // Redriect with a delay:
    header('Refresh: 20; url=http://www.example.org/');

    Can this be inserted antwhere in footer.php?

    Any input is welcome.

  3. olavxxx
    Member
    Posted 6 months ago #

    Here you can read a lot about redirection issues:
    http://en.wikipedia.org/wiki/URL_redirection

    Be aware that if you do a lot of redirection, google may penalize you.
    If your site has moved, you should redirect with 301 permanently moved.

    If redirecting after showing content, I would hook on the get_header .

    function redirectMe(  )
    {
    
    }
    add_action('get_header', 'redirectMe');

    You would need to inject the <meta refresh... /> within the <head></head>. If you wish different redirects, you can inside that function parse out your custom fields, inside the meta refresh.

  4. thewaves
    Member
    Posted 5 months ago #

    OK - I think you have sailed past my level of expertise - which PHP file do I put this code in? Footer.php?

  5. thewaves
    Member
    Posted 5 months ago #

    I have tried putting the following in the header & footer

    <?php
    // Redriect with a delay:
    header('Refresh: 20; url=urel');
    ?>

    It throws the same error every time.

    Warning: Cannot modify header information - headers already sent by (output started at /home/content/07/8625307/html/wp-content/themes/placeholder/header.php:5) in /home/content/07/8625307/html/wp-content/themes/placeholder/header.php on line 29

Reply

You must log in to post.

About this Topic