Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-30-2007, 04:17 PM   #1
LQ Newbie
Registered: Jun 2007
Posts: 16

Rep: Reputation: 0
.htaccess referer problem

Dear All,

I am using the code at the end of this message to restrict access to a specific directory and sub-directories. The code is supposed to return a 403 error if direct access to the files identified by the extensions below is attempted - and it is supposed to allow access to those files if the referring website is

I am specifically interested in accessing pdf files (last on the list).

I have not played with this for some time but was under the impression that this arrangement worked very well in the past in other places where I tried to block direct access.

Now I discover that even referrals from fail. I can access pdf files if I remove them from the .htaccess list and they get blocked if I add them back. It seems to make no difference if I open a new window or not. I am sure that this worked in the past.

I am using Apache 2.x and Linux Fedora Core 4 on a VPS to which I have root access - I am not very experienced with .htaccess and would appreciate any help.

Thanks - Andrew

***************** CODE begins ***************
Options All -Indexes

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^*$ [NC]
RewriteCond %{HTTP_REFERER} !^*$ [NC]
RewriteCond %{HTTP_REFERER} !^$ [NC]
RewriteCond %{HTTP_REFERER} !^$ [NC]
RewriteRule .*\.(php|htm|html|inc|jpg|jpeg|gif|png|bmp|swf|mpg|avi|wav|mp3|zip|tgz|bak|doc|pdf)$ - [F,NC]


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
selective referer blocking feature? jiml8 General 2 01-14-2007 01:05 PM
.htaccess problem? Maje Programming 1 06-16-2006 02:38 AM
Referer HTTP Headers and Squid win32sux Linux - Networking 0 09-17-2005 03:02 PM
.htaccess problem lothario Linux - Software 0 01-22-2005 05:20 AM
cannot determine conf location from referer safescott Linux - General 1 06-12-2004 11:13 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:24 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration