can i do two .htaccess file on Web

Discussion in 'PHP' started by harshpatel, Oct 5, 2011.

  1. #1
    I making one website and also want to add blog on that website.

    I want to make two .htaccess file.

    1) for site
    2) for blog

    is it possible ?
     
    harshpatel, Oct 5, 2011 IP
  2. JohnnySchultz

    JohnnySchultz Peon

    Messages:
    277
    Likes Received:
    4
    Best Answers:
    7
    Trophy Points:
    0
    #2
    yes you can..
     
    JohnnySchultz, Oct 6, 2011 IP
  3. shivgupta0001

    shivgupta0001 Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    yes you can have .htaccess for your site but u can't use it for blog
     
    shivgupta0001, Oct 7, 2011 IP
  4. mfscripts

    mfscripts Banned

    Messages:
    319
    Likes Received:
    4
    Best Answers:
    8
    Trophy Points:
    90
    Digital Goods:
    3
    #4
    Yes. The easiest way is to probably have the blog in a separate folder and add the .htaccess file in the root of that folder. I have my blog on http://blog.mydomain.com which is actually a separate folder on the file system called 'blog'. Hence I can do what I want in that folder without disturbing the rest of the codebase.
     
    mfscripts, Oct 7, 2011 IP
  5. Phil_S

    Phil_S Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I agree with mfscripts in the post above, use either subdomains or subdirectories, and you can give each one it's own .htaccess file.

    I've got sites with multiple blogs, shopping carts or whatever each seperated in their own folders, and each with it's own .htaccess file.

    Phil
     
    Phil_S, Oct 7, 2011 IP
  6. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #6
    You can have one .htaccess file in each directory. You can't have 2 files of the same name and extension (.htaccess has no name and the extension htaccess) in the same directory.
     
    Rukbat, Oct 7, 2011 IP
  7. woody allen

    woody allen Peon

    Messages:
    263
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    The two programs can interfere with each other, and your manual edits to .htaccess can make either or both of them think the file is corrupted
     
    woody allen, Oct 11, 2011 IP
  8. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #8
    @woddy allen:
    Since you can't have them both in the same directory, the problem can't occur. (Different .htaccess files in different directories don't interfere with each other, and files don't "think" that other files "are corrupted".)
     
    Rukbat, Oct 14, 2011 IP