htaccess question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • save11
    Confirmed User
    • Nov 2002
    • 222

    #1

    htaccess question

    htaccess question:

    Is this the proper format for blocking hotlinking by domain?
    sogclub being the domain that is hotlinking

    xxx being my (i wish) hehe domain



    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?sogclub.com(/)?.*$ [NC]
    RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://xxx.com/ [R,NC]

    Also, can you insert ip in place of domain name with this format?
    Thanks

    ex:

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?65.125.235.178.com(/)?.*$ [NC]
    RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://xxx.com/ [R,NC]
    345682839
  • directfiesta
    Too lazy to set a custom title
    • Oct 2002
    • 30135

    #2
    why not use the " deny" function in the httpd.conf file , since it is only for one specific domain.
    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

    • save11
      Confirmed User
      • Nov 2002
      • 222

      #3
      Actually i'm getting hotlinked by several but they only show up in the ref log by ip
      345682839

      Comment

      • fiveyes
        Confirmed User
        • Aug 2001
        • 1680

        #4
        Originally posted by save11
        htaccess question:

        Is this the proper format for blocking hotlinking by domain?
        sogclub being the domain that is hotlinking

        xxx being my (i wish) hehe domain



        RewriteEngine on
        RewriteCond %{HTTP_REFERER} !^http://(www\.)?sogclub.com(/)?.*$ [NC]
        RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://xxx.com/ [R,NC]

        Also, can you insert ip in place of domain name with this format?
        Thanks

        ex:

        RewriteEngine on
        RewriteCond %{HTTP_REFERER} !^http://(www\.)?65.125.235.178.com(/)?.*$ [NC]
        RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://xxx.com/ [R,NC]
        There's no difference between "(/)?.*" and simply ".*", they both accept the same strings. The problem is, neither of those two regexes reject anything, it's a useless bit in rewrite code that someone wrote early on and has been repeatedly copied. Numerical IP addreesses will have neither the "www." nor the ".com". So, I'd write this as:

        <B>RewriteCond %{HTTP_REFERER} !^http://65.125.235.178[NC, OR]
        RewriteCond %{HTTP_REFERER} !^http://(www\.)?sogclub.com[NC]
        RewriteRule \.(gif|jpg|jpeg|bmp)$ http://xxx.com/ [R,NC]</B>
        <CENTER><A HREF="http://www.hot-off-bourbon.com/" target="_blank"><IMG SRC="http://www.hot-off-bourbon.com/images/hob-logosmall.jpg" border="0"></A>

        <FONT face="Comic Sans MS" SIZE="-1"><I>Mardi Gras, Spring Break, Wet-T, Night Club Action, UpSkirt, Oil Wrestling, Voyeur</I></FONT></CENTER>

        Comment

        • fiveyes
          Confirmed User
          • Aug 2001
          • 1680

          #5
          Oh, and the target address in the rewriterule need not and really shouldn't contain "http://" and [R], unless you are redirecting to a different server. So, if you're just sending them to the top of your site, write that line as:
          <B>RewriteRule \.(gif|jpg|jpeg|bmp)$ / [NC]</B>
          <CENTER><A HREF="http://www.hot-off-bourbon.com/" target="_blank"><IMG SRC="http://www.hot-off-bourbon.com/images/hob-logosmall.jpg" border="0"></A>

          <FONT face="Comic Sans MS" SIZE="-1"><I>Mardi Gras, Spring Break, Wet-T, Night Club Action, UpSkirt, Oil Wrestling, Voyeur</I></FONT></CENTER>

          Comment

          • save11
            Confirmed User
            • Nov 2002
            • 222

            #6
            Originally posted by fiveyes
            Oh, and the target address in the rewriterule need not and really shouldn't contain "http://" and [R], unless you are redirecting to a different server. So, if you're just sending them to the top of your site, write that line as:
            <B>RewriteRule \.(gif|jpg|jpeg|bmp)$ / [NC]</B>


            Ok.. Thanks.. I'll try it out
            345682839

            Comment

            • Reak
              So Fucking Banned
              • Mar 2003
              • 17920

              #7
              Originally posted by save11
              htaccess question:

              Is this the proper format for blocking hotlinking by domain?
              sogclub being the domain that is hotlinking

              xxx being my (i wish) hehe domain



              RewriteEngine on
              RewriteCond %{HTTP_REFERER} !^http://(www\.)?sogclub.com(/)?.*$ [NC]
              RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://xxx.com/ [R,NC]

              Also, can you insert ip in place of domain name with this format?
              Thanks

              ex:

              RewriteEngine on
              RewriteCond %{HTTP_REFERER} !^http://(www\.)?65.125.235.178.com(/)?.*$ [NC]
              RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://xxx.com/ [R,NC]
              dont know but i know you need to change you sig..

              Comment

              • fiveyes
                Confirmed User
                • Aug 2001
                • 1680

                #8
                Oops, glad you bumped this, I overlooked that you're going about this back-assedwards! Me bad!

                THIS is what you want (No"<B>!</B>'s"):

                <B>RewriteCond %{HTTP_REFERER} ^http://65.125.235.178[NC, OR]
                RewriteCond %{HTTP_REFERER} ^http://(www\.)?sogclub.com[NC]
                RewriteRule \.(gif|jpg|jpeg|bmp)$ / [NC]</B>

                Sorry I didn't catch that first time around....
                <CENTER><A HREF="http://www.hot-off-bourbon.com/" target="_blank"><IMG SRC="http://www.hot-off-bourbon.com/images/hob-logosmall.jpg" border="0"></A>

                <FONT face="Comic Sans MS" SIZE="-1"><I>Mardi Gras, Spring Break, Wet-T, Night Club Action, UpSkirt, Oil Wrestling, Voyeur</I></FONT></CENTER>

                Comment

                • fiveyes
                  Confirmed User
                  • Aug 2001
                  • 1680

                  #9
                  (bumping to make sure <B>save11</B> notices that last change. Otherwise, the only people able to view his images will be the hotlinkers!)
                  <CENTER><A HREF="http://www.hot-off-bourbon.com/" target="_blank"><IMG SRC="http://www.hot-off-bourbon.com/images/hob-logosmall.jpg" border="0"></A>

                  <FONT face="Comic Sans MS" SIZE="-1"><I>Mardi Gras, Spring Break, Wet-T, Night Club Action, UpSkirt, Oil Wrestling, Voyeur</I></FONT></CENTER>

                  Comment

                  • lil2rich4u2
                    ICQ: 175171926
                    • Oct 2002
                    • 11046

                    #10
                    HEY!!

                    Unbeatable hosting! Customer service is top notch!

                    --> ISPrime <-- Do a search on any board, their reputation is rock solid .. for years!!

                    Comment

                    • BlackCrayon
                      Too lazy to set a custom title
                      • Jun 2003
                      • 19634

                      #11
                      i got a little htaccess question of my own.

                      what do i need to add to my htaccess file for a HTTP 301 moved page?
                      you don't know you're wearing a leash if you sit by the peg all day..

                      Comment

                      • fiveyes
                        Confirmed User
                        • Aug 2001
                        • 1680

                        #12
                        Originally posted by BlackCrayon
                        i got a little htaccess question of my own.

                        what do i need to add to my htaccess file for a HTTP 301 moved page?
                        Use a "Redirect permanent" for that. As in

                        <B>Redirect permanent /old-missing-page-1.html http://www.your-url.com/new-replacement-page-1.html
                        Redirect permanent /old-missing-page-2.html http://www.your-url.com/new-replacement-page-2.html </B>
                        <CENTER><A HREF="http://www.hot-off-bourbon.com/" target="_blank"><IMG SRC="http://www.hot-off-bourbon.com/images/hob-logosmall.jpg" border="0"></A>

                        <FONT face="Comic Sans MS" SIZE="-1"><I>Mardi Gras, Spring Break, Wet-T, Night Club Action, UpSkirt, Oil Wrestling, Voyeur</I></FONT></CENTER>

                        Comment

                        • BlackCrayon
                          Too lazy to set a custom title
                          • Jun 2003
                          • 19634

                          #13
                          Originally posted by fiveyes

                          Use a "Redirect permanent" for that. As in

                          <B>Redirect permanent /old-missing-page-1.html http://www.your-url.com/new-replacement-page-1.html
                          Redirect permanent /old-missing-page-2.html http://www.your-url.com/new-replacement-page-2.html </B>
                          much thanks man!
                          you don't know you're wearing a leash if you sit by the peg all day..

                          Comment

                          • LBBV
                            Confirmed User
                            • Aug 2002
                            • 936

                            #14
                            Or, to prevent ANYONE from linking to your images...


                            RewriteEngine on
                            RewriteOptions inherit
                            RewriteCond %{HTTP_REFERER} !^$
                            RewriteCond %{HTTP_REFERER} !^http://.*YOURDOMAIN/.*$ [NC]
                            RewriteCond %{HTTP_REFERER} !^http://.*YOURDOMAIN:80/.*$ [NC]
                            RewriteRule .*[Jj][Pp][Gg]$|.*[Gg][Ii][Ff]$ http://SOMEURL


                            Be sure to replace YOURDOMAIN with your actual domain name, and replace SOMEURL with the URL that you want the surfer to go to should they actually click on the red X on the hot linkers site!
                            National Net Hosting. Handled.
                            See our new line of inexpensive Dedicated Servers | Cabinets starting at $795 | CDN
                            [email protected] | 888-4-NATNET | www.nationalnet.com

                            Comment

                            • fiveyes
                              Confirmed User
                              • Aug 2001
                              • 1680

                              #15
                              Originally posted by LBBV
                              Or, to prevent ANYONE from linking to your images...


                              RewriteEngine on
                              RewriteOptions inherit
                              RewriteCond %{HTTP_REFERER} !^$
                              RewriteCond %{HTTP_REFERER} !^http://.*YOURDOMAIN/.*$ [NC]
                              RewriteCond %{HTTP_REFERER} !^http://.*YOURDOMAIN:80/.*$ [NC]
                              RewriteRule .*[Jj][Pp][Gg]$|.*[Gg][Ii][Ff]$ http://SOMEURL


                              Be sure to replace YOURDOMAIN with your actual domain name, and replace SOMEURL with the URL that you want the surfer to go to should they actually click on the red X on the hot linkers site!
                              Won't block "http://MYDOMAIN/YOURDOMAIN/hotlink-page.html" (you can use "." within a directory name on *nix).
                              <CENTER><A HREF="http://www.hot-off-bourbon.com/" target="_blank"><IMG SRC="http://www.hot-off-bourbon.com/images/hob-logosmall.jpg" border="0"></A>

                              <FONT face="Comic Sans MS" SIZE="-1"><I>Mardi Gras, Spring Break, Wet-T, Night Club Action, UpSkirt, Oil Wrestling, Voyeur</I></FONT></CENTER>

                              Comment

                              Working...