Forum Moderators: phranque

Message Too Old, No Replies

Forcing Apache To Attach Code To Web Pages

         

fixago

8:42 am on May 20, 2006 (gmt 0)



How would one go about making Apache attach a snippet of code to every web page? For example, let's say I own a hosting company, and I offer free hosting. Someone signs up for the free hosting, but Apache attaches a piece of code to every page they create. It's the same thing, for example, GoDaddy does with their free hosting. Here's an example:

<snip>

That header is called via JavaScript, which is parsing an IFRAME to display the ads, Google search, and link backs to GoDaddy.

How would one achieve the same thing?

[edited by: jdMorgan at 4:17 pm (utc) on May 20, 2006]
[edit reason] No URLs, please. See TOS. [/edit]

jdMorgan

5:05 pm on May 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is no native support for this in Apache. You can use PHP server-side or JavaScript on the client-side to do this. If you use a server-side solution, be sure to exclude non-page filetypes from having code prepended: image files, CSS files, external JS files, robots.txt, /w3c/p3p.xml, labels.rdf, etc.

Jim