1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to redirect to a new site after X amount of time

Discussion in 'Web Design' started by dgfalk, Dec 13, 2010.

  1. dgfalk

    dgfalk Power Member

    Joined:
    Apr 26, 2010
    Messages:
    687
    Likes Received:
    94
    I have a word press blog that I want to redirect to a CPA offer after like 5 seconds of being on my page. How do I get every page of my blog to redirect? I see how you can do it with your main domain, but I want it for everypage and after 5 seconds. Thanks
     
  2. JesusBack

    JesusBack Executive VIP Premium Member

    Joined:
    Sep 15, 2010
    Messages:
    1,159
    Likes Received:
    1,284
    Occupation:
    Almost done :D
    Location:
    {calm|cool|collected}
  3. dgfalk

    dgfalk Power Member

    Joined:
    Apr 26, 2010
    Messages:
    687
    Likes Received:
    94
    Thats sorta what Im looking for but not quite. This is an auto blog and I want each new post to redirect to the CPA offer. With that plugin I would have to go in and manually add the new redirect each time the auto blog is updated
     
  4. sirgold

    sirgold Supreme Member

    Joined:
    Jun 25, 2010
    Messages:
    1,260
    Likes Received:
    645
    Occupation:
    Busy proving the Pareto principle right
    Location:
    A hot one
    PHP code to include in the WP template you're using...

    Code:
    [FONT=monospace]
    [/FONT]<?php[FONT=monospace]
    [/FONT]sleep(10); //seconds to wait..[FONT=monospace]
    [/FONT]header("Location:http://www.domain.com/new-location");[FONT=monospace]
    [/FONT]?>[FONT=monospace]
    [/FONT]
    ;)
     
  5. mataff

    mataff Junior Member

    Joined:
    Sep 21, 2008
    Messages:
    139
    Likes Received:
    54
    Something like this:?

    http://www.tizag.com/javascriptT/javascriptredirect.php

    Just set the delayer to how many seconds you want * 1000.

    If you want to hide the id set up a redirect in your htaccess

    and point your window. location to it:

    PHP:
    window.location "http://yourdomain/dir/133435"
    htacess entry
    PHP:
    RewriteRule ^dir/([^/]*) /affredirect.php?affid=$[QSA,PT]
    affredirect.php
    PHP:
    <?php

    $affID 
    $_GET["affid"]

       
    header'Location: http://affiliatelink?id=' $affID ) ;

    ?>
    Just whipped that up quickly from memory to show you an example but the either of the above methods will work perfectly. Go with the second example so your aff code is hidden until the redirect. Hopefully that helps. Add the JavaScript part to template and your good to go.
     
    Last edited: Dec 14, 2010
  6. dgfalk

    dgfalk Power Member

    Joined:
    Apr 26, 2010
    Messages:
    687
    Likes Received:
    94
    Thanks mataff, thats pretty much Im looking for, but I don't know how to actually put it on my site. Like I said Im using wordpress and im putting the first piece of javascript code at the very begining of my single post (single.php) page of my theme. Its not working, do I need to place it somewhere else?
     
  7. mataff

    mataff Junior Member

    Joined:
    Sep 21, 2008
    Messages:
    139
    Likes Received:
    54
    http://shibashake.com/wordpress-theme/wordpress-page-redirect