Go Back   CodingForums.com > :: Server side development > Other server side languages/ issues

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-03-2003, 01:49 AM   PM User | #1
m__
New Coder

 
Join Date: Jan 2003
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
m__ is an unknown quantity at this point
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..
m__ is offline   Reply With Quote
Old 01-04-2003, 09:27 AM   PM User | #2
Feyd
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
Feyd is an unknown quantity at this point
3rd question:
Quote:
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:
Quote:
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:
Quote:
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
Feyd is offline   Reply With Quote
Old 01-04-2003, 05:30 PM   PM User | #3
m__
New Coder

 
Join Date: Jan 2003
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
m__ is an unknown quantity at this point
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__
m__ is offline   Reply With Quote
Old 01-05-2003, 02:57 AM   PM User | #4
m__
New Coder

 
Join Date: Jan 2003
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
m__ is an unknown quantity at this point
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__
m__ is offline   Reply With Quote
Old 01-08-2003, 11:40 AM   PM User | #5
MCookie
Regular Coder

 
Join Date: Jun 2002
Location: NL
Posts: 421
Thanks: 0
Thanked 0 Times in 0 Posts
MCookie is an unknown quantity at this point
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]
MCookie is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:25 PM.


Advertisement
Log in to turn off these ads.