htaccess

Discussion in 'HTML & Website Design' started by izlik, Sep 8, 2007.

  1. #1
    I hope this is here to ask for .htaccess files...

    i have cmoded a few folders 0777 and wonder how i can prevent users from viewing them ? i heard i can do someting with my htaccess file but what ?
     
    izlik, Sep 8, 2007 IP
  2. Camay123

    Camay123 Well-Known Member

    Messages:
    3,423
    Likes Received:
    86
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Place .htaccess file in the folder you want to deny, then add this in it:

    The two last lines are only there to allow any user who comes from either the 192.168.2.1 ip or fish.example.com, if you really want to deny to all, just removed the two last lines.
     
    Camay123, Sep 8, 2007 IP
  3. izlik

    izlik Well-Known Member

    Messages:
    2,399
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    185
    #3

    thank you that worked... however.. the folder im trying to block containt .swf files games and on my page when someone now try to view the swf file it wont load... i added my servers IP address that it still didint work..

    so in short... how can i make users able to load the .swf file if it's linked in a .php file in /root/ but not able to surf to the folder /root/swf where the file resides.
     
    izlik, Sep 8, 2007 IP
  4. Camay123

    Camay123 Well-Known Member

    Messages:
    3,423
    Likes Received:
    86
    Best Answers:
    0
    Trophy Points:
    160
    #4
    Hmmm, good question. That I dont know. I hope someone will answer cause I also want to know if possible.

    Could you:

    Allow localhost


    But, im not sure security wise if it is ok. Beware.
     
    Camay123, Sep 8, 2007 IP
  5. DKameleon

    DKameleon Member

    Messages:
    29
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    38
    #5
    You need to restrict directory indexes:
    http://httpd.apache.org/docs/2.0/mod/core.html#options
    just put into that directory .htaccess with contents:
    Options -Indexes
    Code (markup):
    PS. Will work only if Apache configured with
    AllowOverride Options :)

    Another way is to put empty index.html into that dir :)
     
    DKameleon, Sep 8, 2007 IP