views:

92

answers:

1

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?

A: 

Apache is probably not the right tool for the job, you should look into Squid, a http proxy with support for redirectors.

BTW: You can have a lot of fun with Squid

middus
After following the tutorial you posted a link to, we're making serious progress to achieving the goal by using squid. Thanks!
Matthew