Help to make a script plz

Discussion in 'PHP' started by G-hamsteR, Feb 9, 2008.

  1. #1
    Hello! I want to make a site and need help with a script. Please read the information carefully:

    Let's think that i have the domain example.com .

    I want when i visit test.example.com or SthElse.example.com to say the subdomain.

    I mean that on test.example.com it would say "test" and on SthElse.example.com it would say "SthElse" .

    If it's not possible with subdomains, is it possible to make it like following?
    I want to have example.com for the main site, but if someone visits example.com/test it would say "test". So instead of subdomain, a folder.


    But the important thing is that these folders or domains won't have to be registered.

    I would give you an example of this script, but i can't cause it has a porn photo. If you want to see the site and understant what i mean, pm me.
    I can't tell this site to public.


    Thanks a lot for your time reading this.
     
    G-hamsteR, Feb 9, 2008 IP
  2. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #2
    For subdomains:

    Add a *.example.com A record in your DNS Zone for example.com
    Create a server alias in httpd.conf to *.example.com

    Use the $_SERVER['HTTP_HOST'] parameter to explode the details before the .example.com and echo it.

    Jay
     
    jayshah, Feb 9, 2008 IP
  3. G-hamsteR

    G-hamsteR Well-Known Member

    Messages:
    268
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    125
    #3
    For the folders? Is it easier?


    Edit: Forgot to say thanks man :)
     
    G-hamsteR, Feb 9, 2008 IP
  4. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #4
    A positive reputation would be appreciated :)

    For folders, you can simply user a rewrite rule such as:

    
    ^([A-Za-z0-9]+)$
    
    Code (markup):
    to index.php In your .hta* file.

    Jay
     
    jayshah, Feb 12, 2008 IP