The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Subdomains

Discussion in 'General Discussion' started by FinalSoul, May 22, 2005.

  1. FinalSoul

    FinalSoul Registered

    Joined:
    May 15, 2005
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    When I create a subdomain, I want it to only be accessible by sub.domain.com, not domain.com/sub or www.sub.domain.com. How can I do this?
     
  2. RAIS2

    RAIS2 Well-Known Member

    Joined:
    Jul 16, 2004
    Messages:
    186
    Likes Received:
    0
    Trophy Points:
    16
    You could create a script that checks the url. A validator sort of. Shouldn't be to hard to do, but it would have to be tested to ensure it works for anyother way those files could be called. Although, the script would have to be near the top of every file that was on the subdomain.
     
  3. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    You could also use a .htaccess using mod_rewrite file that simply checks the called URL and if it isn't the subdomain reroute it as appropriate. Read up on mod_rewrite on the Apache site for more info and examples.
     
  4. FinalSoul

    FinalSoul Registered

    Joined:
    May 15, 2005
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
  5. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    The examples are linked to on the bottom of that page:
    http://httpd.apache.org/docs/misc/rewriteguide.html

    If you cannot figure it out, you might be better off asking for help on n apache specific or general web hosting forum unless someone wants to do the legwork for free for you here.
     
Loading...

Share This Page