Web Crew: Mirroring a site?

Discussion in 'OT Technology' started by JayGee, Jun 16, 2007.

  1. JayGee

    JayGee OT Supporter

    Joined:
    Dec 4, 2004
    Messages:
    5,207
    Likes Received:
    0
    I currently have a site (URL A) which has specific header graphics.
    I know it's possible to mirror the site completely using another URL, but I need to use URL B to access the same site but with another header graphic.

    Is it possible to set the web server to detect from the URL and assign the proper header for the proper URL?
     
  2. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
  3. JayGee

    JayGee OT Supporter

    Joined:
    Dec 4, 2004
    Messages:
    5,207
    Likes Received:
    0
    How please?
     
  4. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    well, .htaccess and php can easily do this. www.php.net
     
  5. JayGee

    JayGee OT Supporter

    Joined:
    Dec 4, 2004
    Messages:
    5,207
    Likes Received:
    0
    In tech terms, what is it called so I know what to search for?
     
  6. Coottie

    Coottie BOOMER......SOONER OT Supporter

    Joined:
    Jun 6, 2006
    Messages:
    32,407
    Likes Received:
    0
    Location:
    OKC
    I think it's called a template...but I'm not sure.
     
  7. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    evaluate $_SERVER['HTTP_HOST'] with something like a switch.
     
  8. JayGee

    JayGee OT Supporter

    Joined:
    Dec 4, 2004
    Messages:
    5,207
    Likes Received:
    0
    Would this work if I needed one company logo for URL A and another for URL B?
     
  9. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    yes, assuming that url A and url B were at different domains. You could run either two copies of the same code, or if on the same server, I would have both domains host out of the same wwwdir.

    The switch determines which domain they are browsing based on what they typed into their browser (or the link they followed) and you can serve diff content based on that.
     
  10. JayGee

    JayGee OT Supporter

    Joined:
    Dec 4, 2004
    Messages:
    5,207
    Likes Received:
    0
    It's the same site, same DB, just different URLs (URL B is going to mirror A's site)

    How can it be done if I want to show A.jpg for URL A and B.jpg for URL B?
     
  11. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    I JUST FAWKING TOLD YOUlc
     
  12. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    ARE YOU THAT LAZY!?!?!?!??!?!??!?!
    Code:
    <?php
    switch ($_SERVER['HTTP_HOST']) {
    case "domain1.com":
    case "www.domain1.com":
        // oh shit, it's site1
        echo("<img src="image1.jpg />");
        break;
    
    case "domain2.com":
    case "www.domain2.com":
        // oh shit, it's site2
        echo("<img src="image2.jpg />");
        break;
    
    case "domain3.com":
    case "www.domain3.com":
        // oh shit, it's site3
        echo("<img src="image3.jpg />");
        break;
    
    default:
        // um, what nigga?
        // I don't know about that site.
        echo("What the fuck you want, bitch?");
        exit;
        break;
    }
    ?>
     
  13. JayGee

    JayGee OT Supporter

    Joined:
    Dec 4, 2004
    Messages:
    5,207
    Likes Received:
    0
    Thanks....didn't have to be so mean about it.
     
  14. retorq

    retorq What up bitch??

    Joined:
    Dec 14, 2006
    Messages:
    6,061
    Likes Received:
    0
    Location:
    Mohave Desert
    Why go thru that if you control the server yourself?? You can define the second URL as a seperate website in apache and use sym links to the content that is to be mirrored, no??
     
  15. JayGee

    JayGee OT Supporter

    Joined:
    Dec 4, 2004
    Messages:
    5,207
    Likes Received:
    0
    No idea, that's why I'm asking.
    Is this possible too?
     
  16. skitcy

    skitcy uhm title! ok

    Joined:
    Jan 29, 2005
    Messages:
    1,302
    Likes Received:
    0
    Location:
    Seattle, Washington
    why not make what needs to be swapped out relative to the domain?

    IE pull from same server:

    http://domain.com/pathtofile/file.extension

    IE pull from same directory relative to domain

    /pathtofile/file.extension

    and swap the file out on the mirror server? or maybe im totally missing something here.
     
  17. JayGee

    JayGee OT Supporter

    Joined:
    Dec 4, 2004
    Messages:
    5,207
    Likes Received:
    0
    It's all on one server.
    URL B is just mirroring the domain, the site doesn't really exist.

    The background is that it will allow 2 companies to use the same site.
    If a customer of Company A enters URL A they will see Company A's logo and visa versa.
     
  18. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    um, that's exactly what he's going to do. HOWEVER, that doesn't solve his question of how to serve diff header depending on which domain is visited. My solution fixes that.
     
  19. retorq

    retorq What up bitch??

    Joined:
    Dec 14, 2006
    Messages:
    6,061
    Likes Received:
    0
    Location:
    Mohave Desert
    Right but he wouldn't need image1, image2, image3, he just needs image in each one of the domains he's serving, that image file would be different in each folder . . . no code needed.
     
  20. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    um, no, you're stupid.

    having to maintain the same codebase in many locations when you could just as easily do one is not a good idea.
     
  21. imraven52

    imraven52 New Member

    Joined:
    Dec 5, 2006
    Messages:
    1,353
    Likes Received:
    0
    Location:
    salt lake city, utah
    it's saturday, more beer plz.
     
  22. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    I'm beeing a sissy bitch tonight :o I'm on my second mike's hard lemonade :mamoru:
     
  23. retorq

    retorq What up bitch??

    Joined:
    Dec 14, 2006
    Messages:
    6,061
    Likes Received:
    0
    Location:
    Mohave Desert
    I'm stupid?! He's not maintaining the same code base in multiple locations, he maintaining one code base linked to from multiple locations. The headers will all point to image.jpg which will be relative to the domain path, no need for fancy code, just symlinks. Do I need to draw you a map??
     
  24. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    Tell you what. You go talk to a dozen professionals about this very question. 11 out of 12 are gonna side with me.
     
  25. retorq

    retorq What up bitch??

    Joined:
    Dec 14, 2006
    Messages:
    6,061
    Likes Received:
    0
    Location:
    Mohave Desert
    11 out of 12 will tell the guy to use code for this when doing it without code will work?? I doubt it, we don't even know this guy is running php anywhere on either of his sites . . .
     

Share This Page