Does anyone know the htaccess code that...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RedShoe
    赤い靴 call me 202-456-1111
    • Feb 2001
    • 14831

    #1

    Does anyone know the htaccess code that...

    I need the htaccess code (if there is one) that doesn't allow .jpg or .gif images to be displayed on their own.
    I only want them to be displayed on an html page.

    SPECIALTY COSTUMES • PROPS • FX
    Superheroes • Monsters • Robots
    PM for details


    For any manufacturing needs. Adult or otherwise.

    aka BonsHigh on Insta
    Bonsai weed plants


  • mrkris
    Confirmed User
    • May 2005
    • 2737

    #2
    Make sure you have mod rewrite.

    Rewriteengine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://domain.com/.*$ "NC"
    RewriteRule .*\.(gif|GIF|jpg|JPG)$ - "F"

    PHP-MySQL-Rails | ICQ: 342500546

    Comment

    • RedShoe
      赤い靴 call me 202-456-1111
      • Feb 2001
      • 14831

      #3
      But isn't that just for anti hotlinking? I used that code and I still can see the image. What I want is the code that does not show the image unless it's on an HTML page.

      If that's even possible.

      SPECIALTY COSTUMES • PROPS • FX
      Superheroes • Monsters • Robots
      PM for details


      For any manufacturing needs. Adult or otherwise.

      aka BonsHigh on Insta
      Bonsai weed plants


      Comment

      • mrkris
        Confirmed User
        • May 2005
        • 2737

        #4
        an HTML page is just a bunch of scripting that tells the browser what to display. When your browser sees an image, it grabs the image. In order to do what you want, from what I know, is to have a script READ the image from a non-web accessible directory and spit the contents to the browser.

        PHP-MySQL-Rails | ICQ: 342500546

        Comment

        • RedShoe
          赤い靴 call me 202-456-1111
          • Feb 2001
          • 14831

          #5
          AAhhhh.. that makes sense. Cool man, thanks.
          A non-web accessible browser,... I didn't even think of doing it that way. Thanks.



          edit...
          Ok, so how do I call into a non-web accessible directory?
          Last edited by RedShoe; 08-17-2005, 04:55 PM.

          SPECIALTY COSTUMES • PROPS • FX
          Superheroes • Monsters • Robots
          PM for details


          For any manufacturing needs. Adult or otherwise.

          aka BonsHigh on Insta
          Bonsai weed plants


          Comment

          • mrkris
            Confirmed User
            • May 2005
            • 2737

            #6
            depends on languages, etc. I do lots of php so I use fopen() or something similiar and pass it the path to the image i want to read. I also do this to create images with custom text based on an image template. perhaps someone else out there knows a better method.

            PHP-MySQL-Rails | ICQ: 342500546

            Comment

            • Superterrorizer
              Confirmed User
              • Sep 2003
              • 509

              #7
              Originally posted by mrkris
              Make sure you have mod rewrite.

              Rewriteengine on
              RewriteCond %{HTTP_REFERER} !^$
              RewriteCond %{HTTP_REFERER} !^http://domain.com/.*$ "NC"
              RewriteRule .*\.(gif|GIF|jpg|JPG)$ - "F"

              Or just use that without the
              RewriteCond %{HTTP_REFERER} !^$

              which allows direct linking. The quotes around NC and F should be square braces though.

              No need to dick around with anything else or any kind of scripting.

              Comment

              • jimmyf
                OU812
                • Feb 2001
                • 12651

                #8
                Originally posted by RedShoe
                But isn't that just for anti hotlinking? I used that code and I still can see the image. What I want is the code that does not show the image unless it's on an HTML page.

                If that's even possible.
                the code I've got does what you want, all of my pics are in htm's... so is they type in (example) free1.jpg they go to 404
                Epic CashEpic Cash works for me
                Solar Cash Paysite Plugin
                Gallery of the day freesites,POTD,Gallery generator with free hosting

                Comment

                • mikeyddddd
                  Viva la vulva!
                  • Mar 2003
                  • 16557

                  #9
                  Originally posted by RedShoe
                  I used that code and I still can see the image.
                  Clear cache and then try typing in the pic's URL with the code supplied in place.

                  Comment

                  • jimmyf
                    OU812
                    • Feb 2001
                    • 12651

                    #10
                    AuthUserFile /dev/null
                    AuthGroupFile /dev/null
                    AddHandler server-parsed .html
                    RewriteEngine On
                    RewriteCond %{HTTP_REFERER} !^$
                    RewriteCond %{HTTP_REFERER} !^http://www.YOUR-URL.com/.*$ [NC]
                    RewriteCond %{HTTP_REFERER} !^http://YOUR-URL.com/.*$ [NC]
                    RewriteCond %{HTTP_REFERER} !^http://www.YOUR-URL.com:80/.*$ [NC]
                    RewriteCond %{HTTP_REFERER} !^http://YOUR-URL.com:80/.*$ [NC]
                    RewriteCond %{HTTP_REFERER} !^http://XXX.XXX.XXX.XXX/.*$ [NC]
                    RewriteCond %{HTTP_REFERER} !^http://XXX.XXX.XXX.XXX:80/.*$ [NC]
                    RewriteRule .*\.jpg$ http://www.YOUR-URL.com [R,L]

                    RewriteCond %{HTTP_REFERER} !^$
                    RewriteCond %{HTTP_REFERER} !^http://www.YOUR-URL.com/.*$ [NC]
                    RewriteCond %{HTTP_REFERER} !^http://YOUR-URL.com/.*$ [NC]
                    RewriteCond %{HTTP_REFERER} !^http://www.YOUR-URL.com:80/.*$ [NC]
                    RewriteCond %{HTTP_REFERER} !^http://YOUR-URL.com:80/.*$ [NC]
                    RewriteCond %{HTTP_REFERER} !^http://XXX.XXX.XXX.XXX/.*$ [NC]
                    RewriteCond %{HTTP_REFERER} !^http://XXX.XXX.XXX.XXX:80/.*$ [NC]
                    RewriteRule .*\.gif$ http://www.YOUR-URL.com [R,L]
                    ErrorDocument 400 http://www.YOUR-URL.com/404/404.htm
                    ErrorDocument 401 http://www.YOUR-URL.com/404/404.htm
                    ErrorDocument 403 http://www.YOUR-URL.com/404/404.htm
                    ErrorDocument 404 http://www.YOUR-URL.com/404/404.htm
                    ErrorDocument 500 http://www.YOUR-URL.com/404/404.htm


                    REPLACE XXX.XXX.XXX.XXX 's WITH YOUR ip
                    hit enter 1 or 2 times after the last line

                    IMPORTANT transer it in ASCII
                    Epic CashEpic Cash works for me
                    Solar Cash Paysite Plugin
                    Gallery of the day freesites,POTD,Gallery generator with free hosting

                    Comment

                    • Doc911
                      Confirmed User
                      • Feb 2004
                      • 3695

                      #11
                      yep you didn't clear your cache .


                      For PHP/MySQL scripts ICQ 161480555 or email [email protected]

                      Comment

                      Working...