Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    m__
    m__ is offline
    New Coder
    Join Date
    Jan 2003
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    A few questions about .htaccess -- turn on directory browsing in one folder, etc.

    1. How does one allow directory browsing in one specific directory when the following code is used in the root .htaccess file to prevent directory browsing in general:
    Code:
    IndexIgnore *
    2. How does one allow hot linking to images in a specific folder when the following code is used in the root .htaccess file to prevent hot linking in general:
    Code:
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
    RewriteRule \.(gif|jpg)$ - [F]
    3. Is EVERY command for .htaccess inheritable? For instance, if I use:
    Code:
    AddType application/octet-stream mp3
    in my /mp3 directory, is that the only place that will automatically download mp3 files?


    Thanks,
    m__
    e-mail = codingforums AT couchfort DOT org
    Last edited by m__; 01-03-2003 at 01:58 AM.

  • #2
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    404
    Thanks
    0
    Thanked 0 Times in 0 Posts
    3rd question:
    Is EVERY command for .htaccess inheritable? For instance, if I use:

    Yes, though technically that command in the /mp3 dir would affect all files within that dir, and all dirs within that dir (and the files within that dir, and on and on). Meaning that command in your root htaccess would cause all mp3 files to be octet stream throughout your entire site, unless there was a sub-ht that over-rode the filetype octet somewhere, and that overwriting would only apply in that sole directory and its subs.

    2nd question:
    How does one allow hot linking to images in a specific folder when the following code is used in the root .htaccess file to prevent hot linking in general.

    Use the RewriteEngine block in your global ht as you normally would, but then in the dir that you want holinking allowed, simply stick a new htaccess file that says, only:
    Code:
    RewriteEngine off
    That simply turns off your hotlinking block for that directory and its subs (simple trick, but you'd be amazed how many people run into the same problem with the same exact request).

    1st question:
    How does one allow directory browsing in one specific directory when the following code is used in the root .htaccess file to prevent directory browsing in general:

    you would specify directives for specific directories. Ex:
    Code:
    <Directory "/full/server/path/to/dir/">
            AllowOverride None
            Options None
    </Directory>
    Hope it helps...
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #3
    m__
    m__ is offline
    New Coder
    Join Date
    Jan 2003
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks so much Feyd. (BTW, is your name a reference to Dune?)

    3 - Thanks. That's exactly what I needed to know.

    2 - Excellent.
    This should be broken:

    This should be good:


    1 - I'm getting a error 500 when I try to use this. I changed the dir path to the appropriate one. I've tried with and without quotes (I believe without is correct, right?). I've added this to both the root .htaccess file and the directory specifc .htaccess file?

    Thanks,
    m__

  • #4
    m__
    m__ is offline
    New Coder
    Join Date
    Jan 2003
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    4 - How can I change this code to include subdirectories in the acceptable HTTP_REFERRERs (replacing www\.)?
    Code:
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
    RewriteRule \.(gif|jpg)$ - [F]
    I'm reading the Apache guide for help, but I cannot figure out the REGEXP that would allow this...

    (sorry, I'm new to this)

    Thanks,
    m__

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    NL
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Maybe this will help:

    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://domain.com.* [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.domain.com.* [NC]
    RewriteCond %{HTTP_REFERER} !^http://subdomain.domain.com.* [NC]
    RewriteCond %{HTTP_REFERER} !^http://123.123.123.123.* [NC]
    RewriteRule \.(gif|jpg)$ - [F]


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •