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

Please help How can i redirect to multiple website

Discussion in 'HTML & JavaScript' started by rap8557, Feb 2, 2015.

  1. rap8557

    rap8557 Jr. VIP Jr. VIP

    Joined:
    Sep 15, 2008
    Messages:
    1,331
    Likes Received:
    480
    Hey guys, i dunno how to do this..
    I got 2 files
    1. redirect.html
    2. links.txt

    How can i redirect a page to a list of websites.
    for example

    These are the website on my links.txt file
    google.com
    yahoo.com
    aol.com
    facebook.com
    twitter.com
    vine.co

    When visitor A goes to my redirect.html page it will redirected to google.com
    When visitor B goes to my redirect.html page it will redirected to yahoo.com
    When visitor C goes to my redirect.html page it will redirected to aol.com
    When visitor D goes to my redirect.html page it will redirected to facebook.com
    When visitor E goes to my redirect.html page it will redirected to twitter.com
    When visitor F goes to my redirect.html page it will redirected to vine.co
    And When visitor G goes to my redirect.html page it will redirected to google.com and so on...

    I've already searched for an answer but i didn't get any.

    Thanks
     
  2. lightning37

    lightning37 Newbie

    Joined:
    Dec 12, 2014
    Messages:
    21
    Likes Received:
    4
    Try this:

    hxxp://gist.github. co m/hopki ns-matt/e16f964185767ad8e380
    **fix the URL**
    This will be a lot easier once I can post URLs on here.

    Depending on the permissions set on your server, you may need to manually create an empty txt file named counter.txt.
     
  3. jamb0ss

    jamb0ss Junior Member

    Joined:
    Feb 9, 2012
    Messages:
    125
    Likes Received:
    46
    Occupation:
    Bots programming
    what web-server/apps are u running? without this information this question has no sense
     
  4. Conor

    Conor Elite Member

    Joined:
    Nov 7, 2012
    Messages:
    3,577
    Likes Received:
    5,954
    Gender:
    Male
    Location:
    South Africa
    Home Page:
    Hmm, you could use some kind of "hit counter" to your advantage here. Make it count to 7, and then reset.

    Then, you could make another script that says "If count = 1, redirect to google.com", "If count = 2, redirect to yahoo.com", etc.

    https://github.com/ajay-gandhi/simphp
    http://stackoverflow.com/questions/5607100/redirect-when-condition-met
     
  5. Debugger

    Debugger Junior Member

    Joined:
    Aug 16, 2009
    Messages:
    174
    Likes Received:
    34
    Location:
    India
    You will need to read that file , then you need to take that url where you want to redirect user ,use javascript to redirect simple.

    But first tell what you are using plain html or php ,asp.net ??? on server side
     
  6. Darkhodge

    Darkhodge Newbie

    Joined:
    Feb 27, 2015
    Messages:
    15
    Likes Received:
    3
    Occupation:
    Web Developer
    Location:
    Surrey, UK
    If you can use PHP on your server it should be relatively simple.

    First of all to check if you have PHP enabled, try creating a file with the extension .php . For example create 'test.php' with the contents:

    Code:
    <?php echo "PHP is working"; ?>
    
    Save it and upload it to your server. Access that URL on your browser and if a blank page with the text "PHP is working" is shown (with nothing else), then you have access to PHP.

    Let us know if you have access to PHP, in which case we can help you code it up!
     
    Last edited: Feb 27, 2015