You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by David Culp <dc...@mcleodhealth.org> on 2003/02/18 19:41:14 UTC

[users@httpd] Is It Possible - Using ReWrite To Change Body


Is it possible to use mod_Rewrite to change the contents of the HTML body.

  What I hope to accomplish is to change URL references within the BODY to
   the external proxy's URL.
  This way, when the client "clicks" on a sublink , it will reference an
external proxy's
   name(link)  and not the internal name(link)

Thanks,
David



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Is It Possible - Using ReWrite To Change Body

Posted by Benjamin Krueger <be...@seattlefenix.net>.
* David Culp (dculp@mcleodhealth.org) [030218 10:37]:
> 
> 
> Is it possible to use mod_Rewrite to change the contents of the HTML body.
> 
>   What I hope to accomplish is to change URL references within the BODY to
>    the external proxy's URL.
>   This way, when the client "clicks" on a sublink , it will reference an
> external proxy's
>    name(link)  and not the internal name(link)
> 
> Thanks,
> David

Rewrite is really only for url manipulation. What you're looking for is
more akin to a filter. Happily, if you're running a current 2.x Apache you
have the ability to use filters. Specifically, you either want to write an
output filter to perform the change using the Apache API, or you want to use
an external program to do the filtering for you at high resource cost.

The Apache documentation offers an example of how to configure an external
output filter to replace text in your content.

	Using sed to replace text in the response
	# mod_ext_filter directive to define a filter which
	# replaces text in the response
	#
	ExtFilterDefine fixtext mode=output intype=text/html \
	
	cmd="/bin/sed s/verdana/arial/g"
	
	<Location />
	
	# core directive to cause the fixtext filter to
	# be run on output
	SetOutputFilter fixtext
	
	</Location> 

	(http://httpd.apache.org/docs-2.0/mod/mod_ext_filter.html)

As I mentioned before, this will take a significant draw on your server 
resources as every request will require forking a new instance of the 
external filter.

-- 
Benjamin Krueger

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org