htaccess referral redirect loop error

5 replies
Hi there,

First post, thanks for your help through google searches it helped me find:

http://www.warriorforum.com/programm...-referrer.html

to help me write a rule in our htaccess to prevent some unwanted traffic, but its still not quite complete. I get a redirect loop error in chrome and have to refreash the page in order for the page to display. Other browsers it wont even load. Pardon me if real URLs arent allowed. Here is the code below
Code:
RewriteCond %{HTTP_REFERER} ^http://taichi37.wordpress.com [NC]
RewriteCond %{REQUEST_URI} !^http://gothunts.com/zimbabwe-non-trophy-elephant-hunts/
RewriteRule ^.*$ /see-what-happens-to-an-elephant-after-elephant-hunting/ [R=302,L]
#error #htaccess #loop #redirect #referral
  • Profile picture of the author RobinInTexas
    Try using the complete url on the last line http://yoursite.com/see-what-happens...phant-hunting/


    instead of /see-what-happens-to-an-elephant-after-elephant-hunting/
    Signature

    Robin



    ...Even if you're on the right track, you'll get run over if you just set there.
    {{ DiscussionBoard.errors[9096566].message }}
    • Profile picture of the author cjreynolds78
      Thank you for the response, still getting a loop error.
      {{ DiscussionBoard.errors[9096679].message }}
      • Profile picture of the author David Beroff
        To stop the loop, the URL parts of lines 2 and 3 must match, while keeping the rest of the syntax the same. Alternatively, keep what you have and remove the exclamation point from line 2.

        The first approach (with the "!") says, "anything that isn't (target) should redirect to (same target)". The second approach (without the "!") says, "requests for (here) should redirect to (there)".
        Signature
        Put MY voice on YOUR video: AwesomeAmericanAudio.com
        {{ DiscussionBoard.errors[9097325].message }}
        • Profile picture of the author cjreynolds78
          Thanks again for the response. It still hasn't fixed the problem, I'm starting to wonder if it has something to do with the simple redirect plugin we are using for wordpress.... I'll have to test it late at night..

          Thanks again for all the help!
          {{ DiscussionBoard.errors[9098749].message }}
          • Profile picture of the author RobinInTexas
            Sounds like the plugin is fighting your htaccess rules.

            It's always night somewhere.
            Signature

            Robin



            ...Even if you're on the right track, you'll get run over if you just set there.
            {{ DiscussionBoard.errors[9100676].message }}

Trending Topics