Go Back   CodingForums.com > :: Server side development > Apache configuration

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-10-2008, 04:07 AM   PM User | #1
lmabee
New to the CF scene

 
Join Date: Jan 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
lmabee is an unknown quantity at this point
Htaccess - Hotlinking, Banning, Coding -

Hey Coding Comrades,
I have been following the tutorials available on javascriptkit.com and just noticed they had a forum! How fantastic!
I have been trying to understand Htaccess for a couple of months, and would love to run my code by the professionals

So... what I am trying to do is block people from hot linking my media (mp3, avi, wmv, png, gif, jpg) as well as disable Directory Searching.

So after reading the lovely tutorial available on javascriptkit.com, I have a question...

When blocking websites from accessing your site you use:

RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} badsite\.com [NC,OR]
RewriteCond %{HTTP_REFERER} anotherbadsite\.com
RewriteRule .* - [F]

But! When I am trying to douse all hotlinking, I want to use this:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite.com/.*$ [NC]
RewriteRule \.(gif|jpg|wmv|avi|mp3|png|mov)$ - [F]

Is the latter going to overwrite the former? Because the coding is pretty much the same thing. SO, it's my understanding that the first bit of code is to make the "bad sites" not be able to access my website, and the second part of the code is to make my site the only own who can access all the media. Is my understanding correct?

My last question is on Index searching... by placing this code in my htaccess:

IndexIgnore *.gif *.jpg *.wmv *.avi *.mp3 *.png *.mov

Am I correct in saying all my media will not show when someone accesses my directories?

Thank you so much for your time and patience guys,
I really do appreciate your help.

With warmest regards,
Laura
lmabee is offline   Reply With Quote
Old 01-10-2008, 07:24 AM   PM User | #2
shyam
Senior Coder

 
shyam's Avatar
 
Join Date: Jul 2005
Posts: 1,563
Thanks: 2
Thanked 163 Times in 160 Posts
shyam will become famous soon enough
whither xml?
__________________
You never have to change anything you got up in the middle of the night to write. -- Saul Bellow
shyam is offline   Reply With Quote
Old 01-10-2008, 02:48 PM   PM User | #3
lmabee
New to the CF scene

 
Join Date: Jan 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
lmabee is an unknown quantity at this point
To be honest Shyam, I didn't know where to put this thread.
So I did a forum search and posted where most of the Htaccess stuff seemed to be.

Can you direct me to a correct spot if I'm in the wrong place?
I appreciate your reply!
Thank you,
Laura
lmabee is offline   Reply With Quote
Old 01-12-2008, 06:45 AM   PM User | #4
Alex Vincent
Moderator


 
Join Date: May 2002
Location: Hayward, CA
Posts: 1,427
Thanks: 1
Thanked 19 Times in 17 Posts
Alex Vincent is on a distinguished road
Moved to Server side development.
__________________
"The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
June 30, 2001
author, Verbosio prototype XML Editor
author, JavaScript Developer's Dictionary
https://alexvincent.us/blog
Alex Vincent is offline   Reply With Quote
Old 01-12-2008, 08:06 AM   PM User | #5
shyam
Senior Coder

 
shyam's Avatar
 
Join Date: Jul 2005
Posts: 1,563
Thanks: 2
Thanked 163 Times in 160 Posts
shyam will become famous soon enough
[QUOTE=lmabee;645457]
RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} badsite\.com [NC,OR]
RewriteCond %{HTTP_REFERER} anotherbadsite\.com
RewriteRule .* - [F]

Quote:
Originally Posted by lmabee View Post
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite.com/.*$ [NC]
RewriteRule \.(gif|jpg|wmv|avi|mp3|png|mov)$ - [F]

Is the latter going to overwrite the former? Because the coding is pretty much the same thing. SO, it's my understanding that the first bit of code is to make the "bad sites" not be able to access my website, and the second part of the code is to make my site the only own who can access all the media. Is my understanding correct?

IndexIgnore *.gif *.jpg *.wmv *.avi *.mp3 *.png *.mov

Am I correct in saying all my media will not show when someone accesses my directories?
2 points scored 1 for each correct answer
__________________
You never have to change anything you got up in the middle of the night to write. -- Saul Bellow
shyam 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 02:03 AM.


Advertisement
Log in to turn off these ads.