I'm providing free wifi service and need an ad to be added to all page requests.
Currently I have a router forwarding all http requests to an apache server, which redirects all requests to an index.php page. The index.php page reads the request, fetches the content from the appropriate site, and edits the content to include the ad.
The problem is that all images and css files etc. cannot be accessed, because when the browser tries to get the image <img src="site.com/image.jpg"> it's just redirected back to the index.php.
I can change settings for the router (running dd-wrt) and the webserver (apache2 and php 5.2).
Is there a solution that allows content to be edited before returning to the client, and allows css and images to be accessed?