You are here: Re: No Images - Found Something! (was Re: No Images) « HTML « IT news, forums, messages
Re: No Images - Found Something! (was Re: No Images)

Posted by Rik on 01/29/07 20:00

Blinky the Shark <no.spam@box.invalid> wrote:
>>> RewriteEngine on
>>> RewriteCond %{HTTP_REFERER} !^$
>>> RewriteCond %{HTTP_REFERER} !^http://blinkynet.net/.*$ [NC]
>>> RewriteCond %{HTTP_REFERER} !^http://blinkynet.net$ [NC]
>>> RewriteCond %{HTTP_REFERER} !^http://www.blinkynet.net/.*$ [NC]
>>> RewriteCond %{HTTP_REFERER} !^http://www.blinkynet.net$ [NC]
>>> #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
>>> Looks sensible?
>>
>> RewriteCond %{HTTP_REFERER} !^$
>> RewriteCond %{HTTP_REFERER} !^http://(www\.)?blinkynet.net(/|$) [NC]
>> RewriteRule \.(jpg|jpeg|gif|png|bmp)$ - [F]
>
> That to be used instead of the lines I pasted?

Yup, does exactly the same, only shorter. One could even take the empty
referer in the same statement:

RewriteCond %{HTTP_REFERER} !^(http://(www\.)?blinkynet.net(/|$)|$) [NC]
RewriteRule \.(jpe?g|gif|png|bmp)$ - [F]

Tends to get a bit unreadable though :-)

>>> There's none of that in the .htaccess that's in my images subdirectory,
>>> and since there are lines like AddHandler and DefaultCharset in that
>>> one
>>> I sense it's a file that simply got mis-saved to the wrong place.
>>
>> There's no way for us to tell how it got there, and what it's purpose
>> was
>> :P
>
> Well, no shit. :) My question meant, "Are there any reasons that a
> separate .htaccess in an images directory might be useful?"

..htaccess files slow apache down. It makes sense to place an .htaccess
only in the directory where it's applicable, and not in the root, so other
requests won't have to deal with it.

On the other hand checking a lot of different .htaccess files might slow
it down too. I'm not sure when this becomes a factor.
--
Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация