Forum Moderators: phranque
RewriteEngine on
# redirect images
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://(www\.)?example\.com/ [NC]
RewriteRule \.(gif?jpe?g?)$ /no.$1 [NC,L]
This works well.
Now my question is i want to allow hotlinking from one folder with few banners now what new .htaccess do i have to make so that hotlinking is allowed from this folder only and all others are protected.
this is my server
var/home/web/htdocs/ .htaccess with anti hotlink code
var/home/web/htdocs/images/ this is auto protected by above htaccess file
var/home/web/htdocs/faq/icons/ this one is protected to ..
now i made a folder at:
var/home/web/htdocs/faq/icons/protect/
now what sort .htaccess file do i have to put inside the folder /protect/ to allow hotlinking from this folder only so i can put some banners inhere ....
pls advise
[edited by: DaveAtIFG at 4:52 pm (utc) on Jan. 14, 2004]
[edit reason] Revised URL pattern to "example" [/edit]
Simply add another RewriteCond to your existing code in /htdocs:
RewriteEngine on
# redirect images except banners
[b]RewriteCond %{REQUEST_URI} !^/faq/icons/protect/[/b]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com/ [NC]
RewriteRule \.(gif¦jpe?g?)$ /no.$1 [NC,L]
can you give me more details on what;
RewriteCond %{REQUEST_URI}!^/faq/icons/protect/
ecactly will do?
will it exclute this fodler protect or will it only stop hotlinking in folder protect?
what i need is that all folders are antihotlink protected ecept from one folder ...