SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: URL switching

  1. #1
    SitePoint Enthusiast daliren's Avatar
    Join Date
    Oct 2001
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    URL switching

    I would like to be able to put several small websites into one hosting account, for example, say I want to get www.smallwebsiteA.com and www.smallwebsiteB.com hosted on the same server, each with their own respective index.php pages. Is there a PHP script I can use to get the incoming URL request and redirect the user to the correct homepage?
    cheers,

    Darren Cassidy

  2. #2
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well if they are both coming from to the same script, you could use $_SERVER['HTTP_HOST'] (I think) to determine what the user requested.
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  3. #3
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by daliren
    I would like to be able to put several small websites into one hosting account, for example, say I want to get www.smallwebsiteA.com and www.smallwebsiteB.com hosted on the same server, each with their own respective index.php pages. Is there a PHP script I can use to get the incoming URL request and redirect the user to the correct homepage?
    This is more easily achieved as an actual host thing... who is your host and what is the CP? Most will allow for multiple domains on a single server. Worth checking before hacking it, though i am sure you would be able to do it with some sort of mod_rewrite()
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  4. #4
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, you should be able to setup VirtualServers with apache to go to different dirs, might be worth looking into as well.
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •