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
I then have a file at /var/www/adblock/index.htm with this in it.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-GB">
<head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <meta http-equiv="Content-Language" content="en-GB"> <meta name="GENERATOR" content="Text Editor"> <meta name="ProgId" content="Text Editor"> <meta name="AUTHOR" content="YOUR_NAME"> <meta name="rating" content="general"> <title>AdBlock</title> </head> <body> <p>AdBlock</p> </body> </html>
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.