.htaccess and sub-directories

Discussion in 'Apache' started by GTech, Apr 2, 2005.

  1. #1
    I have a directory site that uses .htaccess and mod_rewrite to create SEF urls. Works great.

    I've created a new sub-directory called /shopping

    I'm putting a shopping/store app there that also uses .htaccess and mod_rewrite for it's own code.

    The problem is, the root .htaccess seems to be taking priority over the .htaccess in the /shopping directory.

    Is there any directive or command I can add to the .htaccess in /shopping to tell it not to use anything from the root .htaccess?
     
    GTech, Apr 2, 2005 IP
    BamaStangGuy likes this.
  2. fryman

    fryman Kiss my rep

    Messages:
    9,604
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    370
    #2
    can't you put another .htaccess in that folder?
     
    fryman, Apr 2, 2005 IP
  3. GTech

    GTech Rob Jones for President!

    Messages:
    15,836
    Likes Received:
    571
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I have, and it doesn't seem to make a difference.

    I know both work individually well. It's when I add the amazon shopping script I have to the shopping directory, the mod_rewrite seems to inherit from the root.
     
    GTech, Apr 2, 2005 IP
  4. honey

    honey Prominent Member

    Messages:
    15,555
    Likes Received:
    712
    Best Answers:
    0
    Trophy Points:
    325
    #4
    post the codes of both your .htaccess. Your rules might be similar overwriting each other. Otherwise, in all subcats, the .htaccess overwrites the parent.
     
    honey, Apr 2, 2005 IP
  5. fryman

    fryman Kiss my rep

    Messages:
    9,604
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    370
    #5
    Make sure you have the right .htacess in the folder and not just a copy of the main one
     
    fryman, Apr 2, 2005 IP
  6. GTech

    GTech Rob Jones for President!

    Messages:
    15,836
    Likes Received:
    571
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks both for your willingness to help.

    I think I've figured out the problem. In the sub directory "/shopping" .htaccess, I had:

    
    RewriteEngine on 
    RewriteBase /
    
    Code (markup):
    I changed it to:

    
    RewriteEngine on 
    RewriteBase /shopping/
    
    Code (markup):
    and now everything is working as it should be. Another day, another .htaccess mystery solved :)

    Thanks again for your offers to help.
     
    GTech, Apr 3, 2005 IP
  7. just-4-teens

    just-4-teens Peon

    Messages:
    3,967
    Likes Received:
    168
    Best Answers:
    0
    Trophy Points:
    0
    #7
    i had a similar problem with my directory and only .htaccess would work was if i create a sub-domain for it instead of a sub-dir
     
    just-4-teens, Apr 3, 2005 IP