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

Can I redirect single domain to more than 1 website?

Discussion in 'General Scripting Chat' started by MrChow, Feb 13, 2017.

  1. MrChow

    MrChow Junior Member

    Joined:
    Jul 6, 2016
    Messages:
    135
    Likes Received:
    31
    Gender:
    Male
    Is it possible to point 1 domain to multiple websites? Like each time you visit the domain you are randomly redirected to one of the websites prior set to redirect to? Thank you.
     
  2. Heisenberg

    Heisenberg Jr. VIP Jr. VIP

    Joined:
    Sep 11, 2014
    Messages:
    720
    Likes Received:
    375
    Occupation:
    Freelancer
    Location:
    Croatia
    Yes its possible, but why are you asking about that in "Introductions"?
    edit: here you go, just make index.php and paste this there.

    PHP:
    <?php
    $random 
    rand(1,3);
    if (
    $random == 1){
        
    header('Location: http://www.example1.com/');
    }elseif (
    $random == 2){
        
    header('Location: http://www.example2.com/');
    }else{
        
    header('Location: http://www.example3.com/');
    }

    ?>
     
  3. SerpMaster

    SerpMaster Newbie

    Joined:
    Jan 25, 2017
    Messages:
    42
    Likes Received:
    0
    Gender:
    Male
    it's possible to use php script. so on the redirect page, you'll have bunch of if statement that goes to different redirect using php redirect (location:)
     
  4. MrChow

    MrChow Junior Member

    Joined:
    Jul 6, 2016
    Messages:
    135
    Likes Received:
    31
    Gender:
    Male
    Oh shit, my bad.
    Edit: Thanks for the script, but I was asking only if you have a domain.
    Sure, but you'd need a hosting. Im asking only if you have a domain.
     
  5. Heisenberg

    Heisenberg Jr. VIP Jr. VIP

    Joined:
    Sep 11, 2014
    Messages:
    720
    Likes Received:
    375
    Occupation:
    Freelancer
    Location:
    Croatia
    If you seriously can't afford hosting just go with some free one and put domain there with this script i pasted in post above.
     
    • Thanks Thanks x 1
  6. SerpMaster

    SerpMaster Newbie

    Joined:
    Jan 25, 2017
    Messages:
    42
    Likes Received:
    0
    Gender:
    Male
    that i'm not sure, so you want to redirect on the registrar
     
  7. MrChow

    MrChow Junior Member

    Joined:
    Jul 6, 2016
    Messages:
    135
    Likes Received:
    31
    Gender:
    Male
    I can afford a hosting, I just dont require one for what I am doing. And buying a hosting just to redirect domains, nah.
    I am aware I can redirect a domain to another site directly from the registar, I just need to know if I can do that multiple times, so when it redirects it randomly chooses. Not very informed on this, thats why im asking
     
  8. Heisenberg

    Heisenberg Jr. VIP Jr. VIP

    Joined:
    Sep 11, 2014
    Messages:
    720
    Likes Received:
    375
    Occupation:
    Freelancer
    Location:
    Croatia
    No you can't do that. That is why I gave you php script, if you could I would have pointed out that right away.
     
  9. MrChow

    MrChow Junior Member

    Joined:
    Jul 6, 2016
    Messages:
    135
    Likes Received:
    31
    Gender:
    Male
    Thats all I needed to know.
     
  10. sub001

    sub001 Regular Member

    Joined:
    Nov 17, 2016
    Messages:
    222
    Likes Received:
    56
    Just curious, what is the reason you want to do this?
     
  11. emptyzero

    emptyzero Regular Member

    Joined:
    Aug 13, 2012
    Messages:
    489
    Likes Received:
    224
    Gender:
    Male
    Occupation:
    Digital Marketing
    Location:
    Lebanon
    The " thing " you are trying to do won't work unless you get the domain indexed again in google :) and also won't work if you do multiple domain redirects.
    you can get yourself a host for a month, search for some trial hostings .. get the domain indexed and make sure google know that your domain is back live again. once you start seeing newly indexed pages.. go for the " thing "
    anyway, the "thing" requires a 303 permenant redirect :D not a php redirect.
     
  12. WizGizmo

    WizGizmo Super Moderator Staff Member Moderator Jr. VIP Premium Member

    Joined:
    Mar 28, 2008
    Messages:
    4,191
    Likes Received:
    55,962
    Thread moved to the Scripting Chat section.
     
  13. Heisenberg

    Heisenberg Jr. VIP Jr. VIP

    Joined:
    Sep 11, 2014
    Messages:
    720
    Likes Received:
    375
    Occupation:
    Freelancer
    Location:
    Croatia
    What the hell are you talking, he wanted random multiple redirection, which is exactly php script for.
     
  14. emptyzero

    emptyzero Regular Member

    Joined:
    Aug 13, 2012
    Messages:
    489
    Likes Received:
    224
    Gender:
    Male
    Occupation:
    Digital Marketing
    Location:
    Lebanon
    Your script work fine, but not for SEO :D
     
  15. Heisenberg

    Heisenberg Jr. VIP Jr. VIP

    Joined:
    Sep 11, 2014
    Messages:
    720
    Likes Received:
    375
    Occupation:
    Freelancer
    Location:
    Croatia
    Where did he mention SEO? he obviously wanted it for a different reason.
     
  16. Trolling4Dollars

    Trolling4Dollars Jr. VIP Jr. VIP

    Joined:
    Jun 1, 2016
    Messages:
    527
    Likes Received:
    118