Grow your CSS skills. Land your dream job.

Redirect index.html only once

  • # December 24, 2012 at 8:59 am

    Hello forums :),

    I have one little problem regarding **htaccess redirects**. Basically what I’m trying to do is redirect **index.html** to a different html file/folder (**christmas.html** or /christmas for example). That works well but the thing is that I want to show this page only once. When someone visits the page they are redirected to christmas subfolder with a little Merry Christmas wishing and a link to return back to the website (main index.html).

    And here is the problem because when they click the link pointing to main index.html, it of course redirects them back to the christmas subfolder and then over again. Is there a way to fix this and only redirect them the first time? Or some other way to make this work?

    Thanks in advance,
    I wish you all Merry Christmas :)

    # December 24, 2012 at 9:34 am

    I’m not sure about this but you may want to look into document.referrer

    What this does is if anyone came from youtube.com, redirect them to site2.html.

    var ref = document.referrer;
    if(ref && ref.toLowerCase().indexOf(“youtube.com”)!==-1){
    window.location.href=”site2.html”;
    }

    # December 24, 2012 at 10:30 am

    How could I apply this to my example?

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".