Support » Everything else WordPress » Redirect on my post is also redirecting my front page

  • I am trying to set up a redirect on a post –…round-1-take-2/ ‎- so that users can only visit it once a day to prevent them from voting multiple times.

    The code I am using is

    // page to go to if cookie exists
    go_to = "";
    // number of days cookie lives for
    num_days = 1;
    function ged(noDays){
    var today = new Date();
    var expr = new Date(today.getTime() + noDays*24*60*60*1000);
    return expr.toGMTString();
    function readCookie(cookieName){
    var start = document.cookie.indexOf(cookieName);
    if (start == -1){
    document.cookie = "seenit=yes; expires=" + ged(num_days);
    } else {
    window.location = go_to;
    // -->

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    I inserted it into my post using the Per Post Scripts and Style plugin. The redirect works great on the post, but it is also redirecting my front page. None of my other pages appear to be affected by the redirect. Any suggestions?

  • The topic ‘Redirect on my post is also redirecting my front page’ is closed to new replies.