Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
530 views
in Q2A Core by

If someone tries to access blob directly, via say a address like:

http://2outof10wouldnotbang.com/?qa=blob&qa_blobid=15199514007654777792

How can i have this redirected to the actual question that this blob was posted in, in the above case,

http://2outof10wouldnotbang.com/34/would-not-bang-in-a-cupboard

I presume this cannot be achieved within .htaccess file, in fact the above is not being picked up by the usualy hotlink protection entries in .htaccess as below:

#Rewrite RUle for Hotlinking
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?2outof10wouldnotbang\.com/ [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !yahoo\. [NC]
RewriteCond %{HTTP_REFERER} !bing\. [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule \.(gif|jpe?g|png|ti?ff|bmp)$ http://2outof10wouldnotbang.com/qa-media/stop_sign.jpg [R,L]

Q2A version: 1.7

1 Answer

0 votes
by
What do you mean by "directly"? If you mean they typed in the URL, or are using a script of some kind to download your site, they will have a blank Referer. You can block that by removing the last RewriteCond line in your example there. As far as I know that won't cause any problems with regular browsers.

Otherwise it's not really possible. I find the best solution is to keep an eye on your logs and block hotlinking sites (using a blacklist, rather than a whitelist as you have now).
...