Forum Moderators: phranque
Im having to add a 2nd section to my .htaccess to block a referring domain as Im getting hotlinked to hell.
Firstly, I have an .htaccess entry to identify the type of browser (mobile or pc based) and redirect to an appropriate website.
What Im wondering is do I need a second RewriteEngine command for the domain block?
This is what I have now. It works fine but windering if it should be written differently to avoid problems with other browsers...
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^(DoCoMo¦J-PHONE¦KDDI¦UP.Browser¦DDIPOCKET) [NC]
RewriteCond %{REQUEST_URI}!^/mobile
RewriteRule (.*) /mobile/$1 [L]
RewriteEngine on
Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} badbadbadhotlinkingsite\.com
RewriteRule .* - [F]
Any help would be appreciated. Im treading unknown waters here.
(DoCoMo¦J-PHONE¦KDDI¦UP.Browser¦DDIPOCKET) refer to japanese mobile phone telcos.
Wayne
RewriteCond %{HTTP_USER_AGENT} ^(DoCoMoŠJ-PHONEŠKDDIŠUP.BrowserŠDDIPOCKET) [NC]
A little shorter version:
RewriteCond %{HTTP_USER_AGENT} ^(D(oCoMo¦DIPOCKET)¦KDDI¦J-PHONE¦UP\.Browser) [NC]
Just thought I would throw out some ideas for combining... the \. should be used for a litteral .(dot), otherwise .(dot) matches any character except the end of a line.
Justin