Hotlink protection with a query string?

They have: 238 posts

Joined: May 2002

I have a whole bunch of images at somesiteblah32214.com

.. and I want them to only be used on my own myspace account.

Here's what I was able to come up with:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^(https?://([^/]*\.)?myspace\.com/myusername)$ [NC]
RewriteCond %{QUERY_STRING} !^friendid=123456789$ [NC]
RewriteRule .* - [F]
'

However, I cannot for the life of me get the query string part to work. I need to make it so that the rule is true if it doesn't contain "friendid=123456789" anywhere in the query string.

Thanks.

They have: 238 posts

Joined: May 2002

I ended up working out the problem by realising the query string is apart of the referrer (in most cases anyway), so I came up with this code:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^(https?://([^/]*\.)?myspace\.com/myusername)$ [NC]
RewriteCond %{HTTP_REFERER} !.*friendid=0123456789.* [NC]
RewriteRule .* - [F]
'

It allows me to hotlink images from my website on just my own MySpace account.

kk.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.