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.

htaccess unique for subdomain

Discussion in 'General Discussion' started by GoWilkes, Dec 18, 2009.

  1. GoWilkes

    GoWilkes Well-Known Member

    Joined:
    Sep 26, 2006
    Messages:
    367
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Is there a simple way to set up htaccess commands that only apply to a specific subdomain? I would love to have a completely different .htaccess file for the subdomain.

    I'm setting up a beta release for my site, which is at beta.mydomain.com. I need to modify a lot of the htaccess code that's currently being used on my live site, but I don't want these changes to affect the live site while I'm still in beta.

    I know that I can modify the htaccess code to include a lot of RewriteCond (checking for "beta"), but I'm just hoping there's an easier way so that if I break something, it will only kill the beta subdomain and not the entire site.

    TIA,

    Jason


    Sorry to the mods if this question belongs in another section. I wasn't sure where to put it.
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,470
    Likes Received:
    198
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    You should be able to use the same exact file, just edit it for the sub.domain and place it in the root of the sub domain directory.
     
  3. InstaCarma_Tech

    InstaCarma_Tech Well-Known Member

    Joined:
    Apr 22, 2009
    Messages:
    228
    Likes Received:
    1
    Trophy Points:
    18
    Assuming that 'beta' is the doc-root for the sub-domain 'beta.mydomain.com',
    simply create an htaccess file in the folder 'beta' and put the required rules in it. It would just affect the sub-domain.
     
Loading...

Share This Page