Quick htaccess redirection question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • X37375787
    • Jul 2026

    #1

    Quick htaccess redirection question

    This is how my current htaccess looks like

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://domain.com.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.domain.com.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://domain.com:80.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.domain.com:80.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://xx.xx.xx.xx.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://xx.xx.xx.xx:80.*$ [NC]
    RewriteRule .*[Jj][Pp][Gg]$|.*[Gg][Ii][Ff]$ http://www.domain.com/error404.html
    RewriteCond %{HTTP_REFERER} ^http://.+\.sex-top.ru/* [NC]
    RewriteRule .*$ http://www.domain.com/error404.html



    The first part is obviously for hotlink protection, and the second RewriteCondition/Rule combo should actually cause all traffic from sex-top.ru to get redirected to the error404.html page, however it is not working. Am I missing some arguments?

  • X37375787

    #2
    this just causes the hits from sex-top.ru to wait. It doesn't get redirected.

    Comment

    • Lane
      Will code for food...
      • Apr 2001
      • 8496

      #3
      because your 404 file also has the protection and keeps forwarding, getting into an infinite loop

      Comment

      • Madball
        Confirmed User
        • May 2002
        • 748

        #4
        I was wondering the same thing. Currently, I use this .htaccess to redirect a certain domain:

        setenvifnocase Referer "^http://www.leechingfuck.com" spam_ref=1

        <FilesMatch "(.*)">
        Order Allow,Deny
        Allow from all
        Deny from env=spam_ref
        </FilesMatch>

        This produces a 403, the 403 then sends this to my index.html, rather than a gallery page. My problem however is resources:

        Those fucking leeches send me like 150k on a bad day & this bogs down on my server resulting in huge load situations.

        Anybody with a better solution?
        <a href="http://www.homepageofthedead.com"><img src="http://board.gofuckyourself.com/images/globill_88x31.gif"></a>

        Comment

        • X37375787

          #5
          I'll just place the 404 on another domain then.

          Comment

          • fiveyes
            Confirmed User
            • Aug 2001
            • 1680

            #6
            Originally posted by Madball
            I was wondering the same thing. Currently, I use this .htaccess to redirect a certain domain:

            setenvifnocase Referer "^http://www.leechingfuck.com" spam_ref=1

            <FilesMatch "(.*)">
            Order Allow,Deny
            Allow from all
            Deny from env=spam_ref
            </FilesMatch>

            This produces a 403, the 403 then sends this to my index.html, rather than a gallery page. My problem however is resources:

            Those fucking leeches send me like 150k on a bad day & this bogs down on my server resulting in huge load situations.

            Anybody with a better solution?
            Take the code out of .htaccess and place it into access.conf. Then it will be read and parsed only when apache starts instead of every request that comes in. Big savings that!

            In fact, the only .htaccess files on a dedicated box should be temporary test files. Once the code is working properly, it should be transferred on into access.conf. Place it appropriately within a vitual host, directory or file block to control it's usage.
            <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

              #7
              Oh, and for the greatest boost in performance, once you've cleared out your .htaccess files and placed their code within access.conf, you can stop having Apache look for them!

              Just find the line in access.conf that starts with "AllowOverride", comment it out (place a "#" w/o the quotes in front of the line) and on the next line add: "AllowOverride None" (w/o the quotes). Whenever you do need to test new code, delete the "#" from the start of the original line and add it to the front of "AllowOverride None".

              This is a tremendous performance boost, because if the server is expecting .htaccess files on your system, each and every request that comes in results in it looking for one, starting from the top-most directory above and working it's way down to where the file resides.

              If you're smart enough to get rid of those .htaccess files, tell your server that there's no need to look for 'em anymore!
              <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

              • Madball
                Confirmed User
                • May 2002
                • 748

                #8
                Man, thanks for the advice. I will do exactly that!
                <a href="http://www.homepageofthedead.com"><img src="http://board.gofuckyourself.com/images/globill_88x31.gif"></a>

                Comment

                Working...