Quote:
Originally posted by beemk
i tried this htaccess and it send all my traffic to my sponsor, can someone tell me whats wrong?
|
No one else seems willing to give it a shot, so ...
I see a number of errors and problems within the code, which apparently was pasted together from different examples that were found to address different issues. Nothing really wrong with that, except you inherent the typos and possible ignorance of the original author of each snippet. That, and modifying the code to suit your specifics without a grasp of the underlying concepts and rules of the grammar almost assures failure.
Anyway:
Code:
AuthUserFile /dev/null
AuthGroupFile /dev/null
AddType text/html .html .htm
All right, except I don't see the need for the AddType, that should be taken care of in the server's config files.
Code:
<Limit GET>
order allow,deny
allow from all
deny from 212.138.47.*
deny from 194.84.65.*
deny from 212.113.37.194
deny from 217.80.182.65
deny from 213.76.163.16
allow from all
<Limit>
Remove the line in red, it's a repeat.
Code:
RewriteEngine On
RewriteCond %{HTTP_REFERER} www.quality-thumbs.com [OR]
RewriteCond %{HTTP_REFERER} quality-thumbs.com [or]
RewriteRule /* http://www.lightspeedcash.com/link.php?s=LSU&r=245496 [L]
RewriteOptions inherit
This is the error that is causing everyone to be directed to your sponsor- you have a dangling
OR flag without a following condition. A few other problems are in this section of code as well, such as not anticipating a capitalized referrer URL. Try using this instead:
Code:
RewriteEngine On
RewriteOptions inherit
# This next condition takes care of www.quality-thumbs.com
# as well as QUALITY-THUMBS.COM, sending their referrals to your sponsor
RewriteCond %{HTTP_REFERER} quality-thumbs.com [NC]
RewriteRule /* http://www.lightspeedcash.com/link.php?s=LSU&r=245496 [L]
Code:
RewriteCond %{HTTP_USER_AGENT} ^DISCo\Pump.* [OR]
# ... [SNIP] ...
RewriteCond %{HTTP_USER_AGENT} ^lftp.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^tAkeOut.*
RewriteCond %{HTTP_REFERER} ^http://.*trianca.com/*$ [NC]
RewriteCond %{HTTP_REFERER} ^http://.*66.40.119.4:8084/*$ [NC]
RewriteCond %{HTTP_REFERER} ^http://.*chatropolis.com/*$ [NC]
RewriteRule /* http://www.lightspeedcash.com/link.php?s=LSU&r=245496 [R,L]
OUCH!!! This section of code ends up doing
nothing but slow your server down!
Keep in mind that Conditions are ANDed together by default. So, this section is saying-
if any of the User_Agents are robots PLUS they are referred from trianca.com TOGETHER WITH trianca.com AND 66.40.119.4:8084 AS WELL AS chatropolis.com. Well, since there can be only one referrer for each request, as soon as you require two different ones in the Conditions, nothing will match.
Now, you already have a section for quality-thumbs.com referrals to go to LightSpeed, so let's re-do that to include the others as well:
Code:
RewriteEngine On
RewriteOptions inherit
RewriteCond %{HTTP_REFERER} quality-thumbs.com [NC,OR]
RewriteCond %{HTTP_REFERER} trianca.com [NC,OR]
RewriteCond %{HTTP_REFERER} 66.40.119.4:8084 [OR]
RewriteCond %{HTTP_REFERER} chatropolis.com [NC]
RewriteRule /* http://www.lightspeedcash.com/link.php?s=LSU&r=245496 [L]
But, what about that list of robots? Are you sure you want to pass even one of them onto your sponsor?!? I doubt that would be advisable, better to just refuse them outright, like so:
Code:
RewriteCond %{HTTP_USER_AGENT} ^DISCo\Pump.* [OR]
# ... [SNIP] ...
RewriteCond %{HTTP_USER_AGENT} ^lftp.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^tAkeOut.*
RewriteRule .* - [F,L]
But, look at the RewriteRule on this bit- see that ".*"? That is actually a condition, nothing is going to be rewritten unless what is in this position matches the request. In fact, it is the FIRST condition that is checked each time! That's right, before any of the preceding RewriteCond's are considered, the rewrite engine first checks to see if there's a reason to consider them- it looks at the RewriteRule to see if it matches the request and ONLY IF IT DOES, then goes through the list of the RewriteCond's before it.
Now, the point is, ".*" is a wildcard match, it's going to match any and all requests. So, the rewrite engine is going to go through that list above it for every single hit. That is, unless a RewriteRule before it has an "L" flag, where the rule is never encountered. So, this code bit should go at the very last. No sense in making your server process all of this if the next rule sends the visitor off to your sponsor...
Code:
#RewriteCond %{HTTP_REFERER} !^http://130.94.142.130/.*$ [NC]
#RewriteCond %{HTTP_REFERER} !^http://.*idthumbs.com/.*$ [NC]
RewriteRule .*[Jj][Pp][Gg]$|.*[Gg][Ii][Ff]$ http://www.idthumbs.com/
Those two
#'s are causing the following Conditions to be commented out, which results in the RewriteRule to stand alone. In other words, ALL of your image requests are going to be changed, not a good thing! Also, you're not accounting for those browser's that don't supply a referrer. And, keep in mind that a rewrite to http://www.idthumbs.com/ is going to be stripped out since it's yourself, unless you add a "R" flag for an external redirect. So:
Code:
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://130.94.142.130 [NC]
RewriteCond %{HTTP_REFERER} !^http://idthumbs.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.idthumbs.com/ [NC]
RewriteRule .*[Jj][Pp][Gg]$|.*[Gg][Ii][Ff]$ /
Code:
ErrorDocument 403 /index.shtml
ErrorDocument 404 /index.shtml
Good enough, but this usually goes to top of the .htaccess file by convention.
So, the final result (which should give you the desired behavior) would look like this:
Code:
AuthUserFile /dev/null
AuthGroupFile /dev/null
# Remove the "#" from the next line only if needed
#AddType text/html .html .htm
ErrorDocument 403 /index.shtml
ErrorDocument 404 /index.shtml
<Limit GET>
order allow,deny
allow from all
deny from 212.138.47.*
deny from 194.84.65.*
deny from 212.113.37.194
deny from 217.80.182.65
deny from 213.76.163.16
</Limit>
RewriteEngine On
RewriteOptions inherit
RewriteCond %{HTTP_REFERER} quality-thumbs.com [NC,OR]
RewriteCond %{HTTP_REFERER} trianca.com [NC,OR]
RewriteCond %{HTTP_REFERER} 66.40.119.4:8084 [OR]
RewriteCond %{HTTP_REFERER} chatropolis.com [NC]
RewriteRule .* http://www.lightspeedcash.com/link.php?s=LSU&r=245496 [L]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://130.94.142.130 [NC]
RewriteCond %{HTTP_REFERER} !^http://idthumbs.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.idthumbs.com/ [NC]
RewriteRule .*[Jj][Pp][Gg]$|.*[Gg][Ii][Ff]$ / [L]
RewriteCond %{HTTP_USER_AGENT} ^DISCo\Pump.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Drip.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^EirGrabber.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^FlashGet.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^GetRight.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Gets.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Grafula.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^IBrowse.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^InterGET.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Internet\Ninja.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^JetCar.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^JustView.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^MIDown\tool.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Mister\PiX.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^NearSite.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^NetSpider.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Offline\Explorer.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^PageGrabber.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Papa\Foto.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Pockey.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^ReGet.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Slurp.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^SpaceBison.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Teleport.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Teleport\Pro.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebAuto.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebCopier.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebFetch.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebReaper.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebSauger.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebStripper.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebWhacker.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebZIP.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Web\Image\Collector.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Web\Sucker.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Webster.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Wget.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^eCatch.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^ia_archiver.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^lftp.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^tAkeOut.*
RewriteRule .* - [F]
Anyway, that's my take on it. If it doesn't do exactly what you want, I hope it at least steers you in the right direction...