Redirect _all_ queries to a single file

    Date: 02/06/05 (Apache)    Keywords: web, apache

    So I got tired of seeing advertisements on every web page I visit, really really tired. I downloaded a hosts file ( that declares a huge list of servers known to display ads as, which redirects it to the copy of apache I run continuously. This of course speeds up page loads quite a bit, but it would display "page not found" errors everywhere an ad used to be. Sometimes it would just have a picture frame, but the picture would be empty. In any case, I was happy that the ads were gone.
    Then I got to thinking (uh oh!), how could I make this better? I wanted to remove the page not found text and replace it with a blank nothing, like a transparent gif or something. As it turns out, usually the requests the ad servers are to subdirectories or whatnot, usually long strings of meaningless characters. There's no possible way to put a transparent gif at every possible location, but I can use mod_rewrite instead.
    I tried playing around a bit, and came up with the idea of redirecting all requests to a small 1x1 gif that was a single transparent pixel. Problem is, I can't seem to get it to do what I want. Here is the simple rule I came up with in .htaccess

    options +FollowSymLinks

    RewriteEngine On
    RewriteBase /
    RewriteRule (.*) /trans.gif

    I have .htaccess and trans.gif stored in the root of my webserver's directory, which is /Library/WebServer/Documents. I adjusted the entry for that directory to be "AllowOverride All" just in case. Now the server is returning "Internal Server Error" instead of page not found. What am I doing wrong?

    Thanks in advance!


« Ubuntu PHP4 Question || Quick question... »

antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home