Greenguy's Board

Greenguy's Board (http://www.greenguysboard.com/board/index.php)
-   Programming & Scripting (http://www.greenguysboard.com/board/forumdisplay.php?f=15)
-   -   .htaccess problem (http://www.greenguysboard.com/board/showthread.php?t=19970)

Lemmy 2005-05-24 09:59 AM

.htaccess problem
 
So I tried to prevent hotlinking of my mpegs with .htaccess and when i tried to play the movies on the site I got an error msg from WMP saying the server was busy and could not connect. The page loaded fine.

This is my .htaccess document:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://www.quantumporn.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://quantumporn.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://subdomain.quantumporn.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.we-r-sex.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://we-r-sex.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://subdomain.we-r-sex.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.planetofporn.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://planetofporn.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://subdomain.planetofporn.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.lustylemmy.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://lustylemmy.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://subdomain.lustylemmy.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.whothefuckislemmy.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://whothefuckislemmy.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://subdomain.whothefuckislemmy.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.desktopwanker.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://desktopwanker.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://subdomain.desktopwanker.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yahoo.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://yahoo.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.google.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://google.com/.*$ [NC]
RewriteCond %{REMOTE_ADDR} !^68\.169\.210\.217$
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|mp3|mpg|mov)$ - [F,NC]

Options -Indexes

Order Allow,Deny
Allow from all
Deny from flabber.nl
Deny from in.ua
Deny from chatropolis.com
Deny from cs7.chatropolis.com
Deny from forumer.com
Deny from link0777.com
Deny from reapersbondage.com
Deny from urban.ne.jp
Deny from dongtaiwang.com
Deny from fn.com.ua
Deny from chatcannon.de
Deny from monik.cz
Deny from adultchatnetwork.com
Deny from sexloupe.com
Deny from zhonghua999.com
Deny from 212.83.120.133
Deny from fn.in.ua

And this is the movie page: http://desktopwanker.com/freesites/m...gallery_01.htm

I really can't see anything wrong with it, but then I really don't know what I'm doing. I just pieced together the .htaccess from an online tutorial. Can somebody help out?

BTW the movies are working now, I took down the .htaccess.

Thanks

cd34 2005-05-24 10:12 AM

First of all, you are doing:

deny from .domain.com

This may not do what you think it does especially since I see some names in there that are probably meant to block hotlinking from those sites in particular.

But, that's not where this particular .htaccess rule is killing you. Because you have a deny from .domain.com, you are forcing apache to do a reverse DNS lookup on EVERY request for every file served under that .htaccess.

If you get hit with a ton of hotlinking, apache waiting for the DNS resolution will hold open threads and possibly exceed maxclients while it is trying to see if it should allow the person. I would bet if you removed the deny from statements, while it isn't the best set of rules, the machine would run much better and you would be rid of your server busy messages.

Exceeding MaxClients will give the Server Busy message.

Cleo 2005-05-24 10:21 AM

http://desktopwanker.com/freesites/m...gallery_01.htm
Movies play for me.
Using Safari with QuickTime.

Lemmy 2005-05-24 10:33 AM

I tried what you said cd34 and trimmed the .htaccess to this:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://www.quantumporn.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://quantumporn.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://subdomain.quantumporn.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.we-r-sex.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://we-r-sex.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://subdomain.we-r-sex.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.planetofporn.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://planetofporn.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://subdomain.planetofporn.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.lustylemmy.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://lustylemmy.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://subdomain.lustylemmy.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.whothefuckislemmy.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://whothefuckislemmy.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://subdomain.whothefuckislemmy.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.desktopwanker.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://desktopwanker.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://subdomain.desktopwanker.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yahoo.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://yahoo.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.google.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://google.com/.*$ [NC]
RewriteCond %{REMOTE_ADDR} !^68\.169\.210\.217$
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|mp3|mpg|mov)$ - [F,NC]

And the same thing happens "Windows Media Player cannot connect to the server. The server name may be incorrect or the server is busy. Try again later."

Cleo, they played because I took down the .htaccess. I'm not leaving it there as long as it fucks things up.

Cleo 2005-05-24 10:37 AM

Do a test directory with a page of movies and your htaccess.

This is how I do mine and it seems to work without problems, scroll about 2/3 of the ways down on the page.
http://www.cleos-porn-links.com/adul...aster-help.php

Lemmy 2005-05-24 10:43 AM

Quote:

Originally Posted by Cleo
Do a test directory with a page of movies and your htaccess.

This is how I do mine and it seems to work without problems, scroll about 2/3 of the ways down on the page.
http://www.cleos-porn-links.com/adul...aster-help.php

Good idea. Makes it easier to identify the problem without crippling all my movie sites.

cd34 2005-05-24 10:55 AM

oh, haha, sorry. Put this at the top.

RewriteCond %{HTTP_REFERER} !^$ [NC]

Windows Media Player does not send a referrer.

Cleo 2005-05-24 10:59 AM

I just came back to the computer to post that mine, unlike yours, allows for no referral but I see that cd34 beat me to it. :)

Lemmy 2005-05-24 11:42 AM

Quote:

Originally Posted by cd34
oh, haha, sorry. Put this at the top.

RewriteCond %{HTTP_REFERER} !^$ [NC]

Windows Media Player does not send a referrer.

Should that line be instead of, or in addition to

RewriteCond %{HTTP_REFERER} !^$

Either way Cleo's code produces a 404, BUT it works fine on a different server so I'm beginning to think that this has something to do with the server configuration. I'm getting in touch with support at my host.

Thanks guys!

Cleo 2005-05-24 11:49 AM

[NC] - ignore case

So you do not need the NC on a line just telling it that no referral is ok.

cd34 2005-05-24 11:49 AM

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.quantumporn.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://quantumporn.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://subdomain.quantumporn.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.we-r-sex.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://we-r-sex.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://subdomain.we-r-sex.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.planetofporn.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://planetofporn.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://subdomain.planetofporn.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.lustylemmy.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://lustylemmy.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://subdomain.lustylemmy.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.whothefuckislemmy.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://whothefuckislemmy.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://subdomain.whothefuckislemmy.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.desktopwanker.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://desktopwanker.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://subdomain.desktopwanker.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yahoo.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://yahoo.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.google.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://google.com/.*$ [NC]
RewriteCond %{REMOTE_ADDR} !^68\.169\.210\.217$
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|mp3|mpg|mov)$ - [F,NC]

That should work.

Lemmy 2005-05-24 12:11 PM

Thanks cd34, that works! |bananna|

cd34 2005-05-24 12:18 PM

my brain is mush this week re: the [NC] on the empty referrer.

Although, people with lowercase empty referrers might have been able to slip by with Cleo's rule.



Note: For the comedically and/or technically impaired, an empty referrer has no case. It is an attempt at humor. A poor attempt, but an attempt nonetheless to cover up for my sleep-deprived mushy brain. :)


All times are GMT -4. The time now is 10:48 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc