SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot Tiger_Tom's Avatar
    Join Date
    Feb 2000
    Location
    U.K.
    Posts
    194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    .htaccess | HTTP_REFERER | restrict access to ONE file?

    I've found .htaccess code to restrict access to a directory, or a file TYPE,
    based on the referer, but not ONE to file in a directory [based on the referer] e.g. shazam.html

    Can this be done? Does anyone have some *working* code?

    I've found lots of tutorials on the 'net, but the code is either
    unsuitable, or wrapped/broken.

    I'm going to have another poke around, but I thought I'd check this ever-helpful forum first. If I find it, I'll let ya know.
    Last edited by Tiger_Tom; May 30, 2001 at 09:46.

  2. #2
    SitePoint Zealot Tiger_Tom's Avatar
    Join Date
    Feb 2000
    Location
    U.K.
    Posts
    194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think this works:

    AuthUserFile /dev/null
    AuthGroupFile /dev/null

    RewriteEngine On
    RewriteOptions inherit
    RewriteCond %{HTTP_REFERER} !^http://.*superman.com.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://.*superman.com:80.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://tigertom.superman.com.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://66.33.60.177.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://66.33.60.177:80.*$ [NC]
    RewriteRule shazam.html http://www.tigertom.com/bounced.html [R,L]


    Hopefully it wont wrap here.

    ====

    Bugger, it did!
    Last edited by Tiger_Tom; Jun 12, 2001 at 01:49.

  3. #3
    SitePoint Addict Drinky's Avatar
    Join Date
    Jan 2001
    Location
    England
    Posts
    338
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Put it in vb code tags and then it wont
    Drinky

  4. #4
    SitePoint Zealot Tiger_Tom's Avatar
    Join Date
    Feb 2000
    Location
    U.K.
    Posts
    194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That code had an error in it. I've fixed it above.


Bookmarks

Posting Permissions

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