htaccess in a folder

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nico-t
    emperor of my world
    • Aug 2004
    • 29901

    #1

    htaccess in a folder

    i got the root htaccess file blocking hotlinking now.
    Now i want 1 folder on my site to not have this. BUT, that folder does have to block fusker shit and stuff.
    My htaccess code in the root is ok now, so i thought i could get another htaccess file in the folder like this one:

    RewriteEngine On
    RewriteCond %{HTTP_REFERER} ^.*fusker*.*$ [NC]
    RewriteCond %{HTTP_REFERER} ^.*usefulidiot*.*$ [NC]
    RewriteRule \.(jpe?g|gif|bmp|png)$ des/test/hotlinkimg-d.gif [L]

    But that doesnt work... Please someone give me a link about this or explain how i can do this, i searched google and i been searching for this whole afternoon and still found nothing i can use.
  • swedguy
    Confirmed User
    • Jan 2002
    • 7981

    #2
    http://www.htaccesstools.com/

    Comment

    • nico-t
      emperor of my world
      • Aug 2004
      • 29901

      #3
      Originally posted by swedguy
      thanks but that aint got the issue i got: setup specific htaccess options for a folder of my website.

      Comment

      • directfiesta
        Too lazy to set a custom title
        • Oct 2002
        • 30183

        #4
        Aren't all subfolders subject to the " top " htaccess file ???

        So you couldn;t be LESS restrictive, but MORE restrictive in subfolders....

        ????
        I know that Asspimple is stoopid ... As he says, it is a FACT !

        But I can't figure out how he can breathe or type , at the same time ....

        Comment

        • jonesy
          Confirmed User
          • Jan 2003
          • 6688

          #5
          take the htaccess out of your root - drop it in the folder/s you want to protect

          then drop the other htaccess file with the fusker url and drop that into the other folder you want to protect from fusker
          .
          Shooting Bikini Girls

          Comment

          • nico-t
            emperor of my world
            • Aug 2004
            • 29901

            #6
            aha ! well i knew there was something about subfolders etc., i read it somewhere but didnt knew the site anymore... so thanks for the tips, im gonna try it right now.

            Comment

            • nico-t
              emperor of my world
              • Aug 2004
              • 29901

              #7
              fuck this is a lil more complicated then i thought... i have to think backwards and shit.. damn... testing some shit out now tho...

              Comment

              • Project-Shadow
                Confirmed User
                • Feb 2003
                • 7340

                #8
                Place a blank .htaccess file in the folder you want no restrictions on.

                Comment

                • swedguy
                  Confirmed User
                  • Jan 2002
                  • 7981

                  #9
                  Should work...

                  RewriteEngine On
                  RewriteCond %{HTTP_REFERER} ^.*fusker.*$ [NC,OR]
                  RewriteCond %{HTTP_REFERER} ^.*usefulidiot.*$ [NC]
                  RewriteRule \.(jpe?g|gif|bmp|png)$ /test/hotlinkimg-d.gif [L]

                  There should be an OR in all the RewriteCond's except that last one.

                  Comment

                  • nico-t
                    emperor of my world
                    • Aug 2004
                    • 29901

                    #10
                    Originally posted by swedguy
                    Should work...

                    RewriteEngine On
                    RewriteCond %{HTTP_REFERER} ^.*fusker.*$ [NC,OR]
                    RewriteCond %{HTTP_REFERER} ^.*usefulidiot.*$ [NC]
                    RewriteRule \.(jpe?g|gif|bmp|png)$ /test/hotlinkimg-d.gif [L]

                    There should be an OR in all the RewriteCond's except that last one.
                    this kinda misses the point im making i think? This has nothing to do with working with folders, this is just the code itself...
                    And the code itself is working, the OR in it doesnt matter... thanks ne way for you input hehe...

                    anyway, I think its working properly now... let me give u my site structure to show what ive done and what id like:

                    LEVEL 1 - ROOT FOLDER
                    htaccess file with only 404 and 403 redirection in it

                    LEVEL 2 - FOLDER 1, FOLDER 2, FOLDER 3
                    folder 1: htaccess with anti hotlinking from all sites
                    folder 2: htaccess with anti hotlinking from all sites
                    folder 3: htaccess without anti hotlinking, except fusker and usefulidiot

                    ^^^ this seems to work, but that are alot htaccess files...


                    A question to Project-Shadow: so when i put the anti hotlink in the root again, and just a blank htaccess in 'folder 3', it accepts hotlinking from files in folder 3? But what if i only wanna block fusker in folder 3? Is there another way to do that then what i just did?

                    Comment

                    • swedguy
                      Confirmed User
                      • Jan 2002
                      • 7981

                      #11
                      Originally posted by nico-t
                      this kinda misses the point im making i think? This has nothing to do with working with folders, this is just the code itself...
                      You stick it IN the folder you are talking about (folder 3 according to your example)

                      And the code itself is working, the OR in it doesnt matter... thanks ne way for you input hehe...
                      The OR matters a lot.

                      Comment

                      • collegegirlvids
                        Confirmed User
                        • Oct 2004
                        • 535

                        #12
                        I just use proxypass... they take care of everything and you don't have to do anything at all for $50 =)

                        Comment

                        • swedguy
                          Confirmed User
                          • Jan 2002
                          • 7981

                          #13
                          Lets make a test. I have a folder open for all hotlinking, except from gfy.com.

                          You should see a pair of boobies below if you look at this thread from gofuckyourself.com


                          If you look at the same thread from gfy.com, you should see a pink Elephant

                          http://www.gfy.com/showthread.php?t=431645


                          EDIT: Remember to clear your cache, otherwise you will still see the boobs.
                          Last edited by swedguy; 02-14-2005, 10:11 AM.

                          Comment

                          • nico-t
                            emperor of my world
                            • Aug 2004
                            • 29901

                            #14
                            Originally posted by swedguy
                            You stick it IN the folder you are talking about (folder 3 according to your example)


                            The OR matters a lot.
                            yes, im sorry i been working on this for the past 5 hours and im getting a lil slow and very irritated...

                            The good news from my other post that it works now is bullshit, i did a lil testing and its still fucked up.

                            I did see your test, with the boobies and the pink elephant. Im gonna change my file and test it later on, im gonna take a break now im kinda fed up with this shit...
                            thanks for your reply

                            Comment

                            • swedguy
                              Confirmed User
                              • Jan 2002
                              • 7981

                              #15
                              If it wasn't clear before, you will only get the pink elephant when the hotlink protection kicks in (for example from the fusker sites)

                              I used the same htaccess as I posted above.


                              What the OR does is exactly like in the English language.

                              If site is "fusker" OR "usefulidiot" OR "hotlinker2" OR "hotlinker3", redirect them to /test/hotlinkimg-d.gif

                              Comment

                              • nico-t
                                emperor of my world
                                • Aug 2004
                                • 29901

                                #16
                                holy shit i think its working now...
                                what i did:


                                I put this htaccess file in the root directory:
                                Code:
                                ErrorDocument 404 http://www.mydomain.com/404.html
                                ErrorDocument 403 http://www.mydomain.com/404.html
                                
                                RewriteEngine On
                                RewriteCond %{HTTP_REFERER} !^$
                                RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain\.com/ [NC]
                                RewriteCond %{HTTP_REFERER} !^.*msn\. [NC]
                                RewriteCond %{HTTP_REFERER} !^.*yahoo\. [NC]
                                RewriteCond %{HTTP_REFERER} !^.*altavista\. [NC]
                                RewriteCond %{HTTP_REFERER} !^.*google\. [NC]
                                RewriteCond %{HTTP_REFERER} !^.*webcrawler\. [NC]
                                RewriteRule \.(jpe?g|gif|bmp|png)$ des/test/hotlinkimg-d.gif [L]
                                And i put this htaccess file in the folder where sites can hotlink from, except for 'fusker' etc:
                                Code:
                                RewriteEngine On
                                RewriteCond %{HTTP_REFERER} ^.*fusker*.*$ [NC,OR]
                                RewriteCond %{HTTP_REFERER} ^.*usefulidiot*.*$ [NC]
                                RewriteRule \.(jpe?g|gif|bmp|png)$ test/hotlinkimg-d.gif [L]
                                thanks swedguy for explaining

                                Comment

                                • swedguy
                                  Confirmed User
                                  • Jan 2002
                                  • 7981

                                  #17
                                  np

                                  Comment

                                  Working...