Intercept page request behind firewall return altered content with php and apache
Posted
by Matthew
on Stack Overflow
See other posts from Stack Overflow
or by Matthew
Published on 2010-03-21T00:05:29Z
Indexed on
2010/03/21
0:11 UTC
Read the original article
Hit count: 685
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?
© Stack Overflow or respective owner