On 17/09/13 09:59, Mark Rogers wrote:
On 17 September 2013 00:51, steve-ALUG@hst.me.uk wrote:
If I remember correctly, Rewite Rule changes anything and everything on 127.0.0.1 to point to /var/www/adblock/index.htm
[Snip]
The problem with this is that not everything is looking for valid HTML. The example of Google Analytics looking for a JavaScript file is a good one, but it's presumably possible that sometimes (eg) an image or CSS file is expected instead.
At least for when text files are expected, an empty file ("touch index.html" will create it) should be accepted as "valid" HTML/JS/CSS/etc (I know it isn't actually valid HTML but I think all browsers will accept it without complaint?) I think most browsers are OK with it as in image file too but don't quote me on that... As soon as you put content into the file you have problems.
Of-course the re-write rule could be modified to redirect to an appropriate dummy file based on the file extension, although that isn't always reliable: <img src="/blah.php" /> doesn't give the web server much of a clue as to the type of content being expected.
Fair points. IME my solution seems to work for me. I put "Adblock" in the text purely so I could see when something was being blocked.
TBH I don't recall if I was actually already blocking Google Analytics with this approach.
If it helps, Ghostery will block many trackers, and I think there are several plug-ins for browsers which claim to block Google Analytics - e.g. the Google Analytics Opt-out Browser Add-on (currently v 0.96) for Firefox available from Google.
HTH Steve