Subdomains, without actually creating a subdomain

Discussion in 'PHP' started by Arson, Sep 4, 2007.

  1. #1
    I want to make a site with one of the main things being like piczo. I want the visiors to be able to type in username.mysite.com and it takes them to mysite.com and pulls the information for the username infront of mysite.com in the url.

    Is there anyway to do this without using mod_rewrite?
     
    Arson, Sep 4, 2007 IP
  2. Kennedy

    Kennedy Peon

    Messages:
    994
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Ask your host if they support wildcard subdomains. If not, then it is not possible.
     
    Kennedy, Sep 4, 2007 IP
    Arson likes this.
  3. Arson

    Arson Well-Known Member

    Messages:
    622
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    120
    #3
    Thanks. Its a dedicated server, so It should support them.

    I will ask to make sure, but if the server does support wildcard subdomains, how would I go about using them?
     
    Arson, Sep 4, 2007 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    Just type the wanted subdomain infront of your actual domain, and it'll point to your root directory if no other was registered in your cPanel.

    Take an example on my site:

    http://www.randomsig.net/

    Replace the "www" with whatever you want and it'll work.

    http://sgerge.randomsig.net/
    http://_wefwe-.randomsig.net/
    http://4523153few.randomsig.net/
    http://sdr.fwfqwwef.wef.sd.randomsig.net/

    You can fetch the subdomain name with $_SERVER['HTTP_HOST'].


    And if it doesn't support wildcard subdomains, this might be useful.

    http://www.google.com/search?q=htaccess+subdomains
     
    nico_swd, Sep 5, 2007 IP
    Arson likes this.
  5. Arson

    Arson Well-Known Member

    Messages:
    622
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    120
    #5
    Thanks a million for the help!!!!
     
    Arson, Sep 5, 2007 IP