Results 1 to 3 of 3
  1. #1
    zerocold96 is offline Senior Member Well Known
    Join Date
    Feb 2006
    Location
    Inferno
    Posts
    304

    Default hotlinking protection

    ok, how do I protect files from being hotlinked?
    I don't know how to use .htaccess files if you ask. well anyways I want a code that helps me protect my files from the directory : "http://www.website.com/manga_files/". It doesn't matter if is php or .htaccess, but I need a good walktrought please I'm new with both.

    anyone have any ideas?

  2. #2
    Volvogga's Avatar
    Volvogga is offline Senior Member Always Around
    Join Date
    Sep 2005
    Location
    MI, USA
    Posts
    2,076

    Default

    .htaccess seems to be the defacto standard... but it's usually just used for images. I'm looking it up. However you should be aware that .htaccess is limited to Apache servers anyway. You can't use them in windows based servers.

    Hrmm... let me keep looking, check back for an edit periodicly. I think I got it but the informations a little apache.
    *appologies to Iron Skull*

    EDIT:

    Ok, nevermind... I get it. Easy~Pizzy. ^^

    You simply want to include every kind of file you want to block. You can make it so they can still type it in and see it, but can't hotlink, or make it so they can't view it at all unless they come from your site. The forementioned method is usually used with picture files. Seeing as I'm assuming you have *rar and *zip files in that directory (... why the hell don't I just look?... ok, I'll do that after I finnish typing this... err.. nvm, it's a dummy site), you will want to block those file types.

    Start by making a file called .htaccess (or me.htaccess if your running windows). Then enter the following:
    [code]RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^http://www.dummysite.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.dummysite.com$ [NC]
    RewriteRule .*\.(rar|zip|arj)$ http://www.yourdomain.com/BASTARDS.jpe [R,NC][/code]OR
    [code]RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^http://www.dummysite.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.dummysite.com$ [NC]
    RewriteRule .*\.(rar|zip|arj)$ [F,NC][/code]Note that NC means no-case, R means redirection, F means fail it, and the dollar sign... well that's just kinda there. The rest of it seem to follow basic unix conventions as far as the paths go.

    The first redirects them to a picture (MAKE SURE THE PICTURE IS IN A DIRECTORY ABOVE THE HOTLINK PROTECED DIRECTORY, OR YOU WILL SEND YOUR SERVER INTO A LOOP) file that you make that basicly instults them for being hotlinking bastards, and the second gives them a 404 failure as managed by your site. This file goes in the /manga_files directory... prefferably with administrator access for read and write, IE you.

    Note that if you made it in windows, don't forget to rename it to .htaccess once you upload it to the server.
    [code]cp me.htaccess .htaccess
    rm me.htaccess[/code]
    is the safest way.

    Good luck with that.

    Note that I really like this guy's redirect picture... even though he seems to be a honda fan.
    http://hondaswap.com/files/name-tag.gif
    Oh... and ghastly's was good to... ahem. >_>

    EDIT NUMBER TWO!!!:
    Found a file generation site. Weee~
    http://www.htaccesstools.com/hotlink-protection/
    Vol~

    thanks to Silverwmoon!

  3. #3
    zerocold96 is offline Senior Member Well Known
    Join Date
    Feb 2006
    Location
    Inferno
    Posts
    304

    Default wow

    omg thanks I'll try coding it later, right now I'm on school.


    ps: I found tens of sites ,but all of them only gave me hotlink protection for pictures, which is something I don't need.

    edit: ok....... I used the second option and files got block, but it block the normal directory link too. "manga_files/manga_00#.zip" was block as well as "website.com/manga_files/manga_00#.zip"
    Last edited by zerocold96; 11-01-2006 at 07:28 AM.

 

 

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
  •  
vBulletin Skin by: ForumThemes.com
Powered by vBulletin® Version 4.2.0
Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.
SEO by vBSEO 3.6.0 PL2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162