How do I do this... subdomain mod_rewrite

Discussion in 'Apache' started by S2X, Dec 13, 2006.

  1. #1
    How do make computers.mysite.com grab the content from

    mysite.com/view.php?pg=computers
     
    S2X, Dec 13, 2006 IP
  2. wormser

    wormser Well-Known Member

    Messages:
    112
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    138
    #2
    I'm not sure that too many people know how to do that. It's not just a rewrite, you need to change the DNS setting too.
     
    wormser, Dec 13, 2006 IP
  3. john_loch

    john_loch Rodent Slayer

    Messages:
    1,294
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    138
    #3
    Firstly, any subdomains you plan to use need to resolve. Build yourself a list, and set them up in your DNS.

    Now that all subdoms resolve to a single IP, you need to set up a named Vhost that handles all requests to *.mysite.com (or if you have a seperate IP you could make it IP based)

    THEN you can use a mod_rewrite script to map the subdomain requested to an a POST/GET arg as you describe.

    No matter how you approach it, you'll have to sort the first two steps above. After that, its up to you whether you use mod_rewrite, or a customized app/script to handle requests (at least with mod_rewrite, you don't have to change your script.)

    Good luck :)

    JL
     
    john_loch, Dec 13, 2006 IP