dynamic subdomain redirection /apache/php

Discussion in 'OT Technology' started by noon, Mar 4, 2007.

  1. noon

    noon get high and teach me how to listen

    Joined:
    May 4, 2002
    Messages:
    3,384
    Likes Received:
    0
    Location:
    Lawrence, KS
    I am attempting to redirect this url:

    one.two.mysite.com/

    OR

    www.one.two.mysite.com/

    to

    mysite.com/index?a=one&b=two

    however,

    one.mysite.com

    OR

    www.one.mysite.com

    should transfer to mysite.com/index?a=one

    right now I am running Apache on this computer for testing.. so I can directly edit httpd.conf, but I really suck at RewriteCond and RewriteRule.. can anyone help me out?
     
  2. noon

    noon get high and teach me how to listen

    Joined:
    May 4, 2002
    Messages:
    3,384
    Likes Received:
    0
    Location:
    Lawrence, KS
    still working on this shit :o
     
  3. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    should be easy:

    Code:
    <virtualhost 10.1.2.3>
    servername one.two.mysite.com
    
    Redirect / +
    http://mysite.com/index?a=one&b=two
    </virtualhost>
    no?
     
  4. Sexual Vanilla

    Sexual Vanilla New Member

    Joined:
    May 23, 2005
    Messages:
    6,305
    Likes Received:
    0
    Location:
    South Carolina
    I don't mean to hijack this thread or anything, but I have a similar question (I think). I'm running XAMPP on an XP machine just to get a feel for it. If I go to localhost (or my IP address when I'm not on the machine), it brings me to to the XAMPP login page. I must type in, say, IPaddress/home.php or localhost/home.php in order to get to pages I've written. What should I do to have it go directly to home.php whenever I browse to localhost or my IP address, rather than the XAMPP admin page?
     
  5. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    modify the "directoryindex" directive in your httpd.conf:

    Change:
    DirectoryIndex index.html

    To:
    DirectoryIndex home.php index.html

    Then:
    Reload Apache

    Apache will cycle through the list (entries seperated by a space) until it finds one that is valid for that directory.
     
  6. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    however, you really should be using index.php for your default pages... that's more the industry-standard.

    I'd recommend you run XAMPP on a seperate virtual server, bound to a different port (such as 81).
     
  7. noon

    noon get high and teach me how to listen

    Joined:
    May 4, 2002
    Messages:
    3,384
    Likes Received:
    0
    Location:
    Lawrence, KS

    one and two are completely dynamic, meaning *.*.mysite.com will direct to index.php?a=*&b=*
     
  8. Sexual Vanilla

    Sexual Vanilla New Member

    Joined:
    May 23, 2005
    Messages:
    6,305
    Likes Received:
    0
    Location:
    South Carolina
    Awesome. I'll try that. Thanks. :bigthumb:
     
  9. noon

    noon get high and teach me how to listen

    Joined:
    May 4, 2002
    Messages:
    3,384
    Likes Received:
    0
    Location:
    Lawrence, KS

Share This Page