I came across interesting module for apache which does automatic search and replacement operations using regular expressions and decided to experiment on it. For information about this module documented in apache website
NOTE: This module is only available in Apache 2.2.7 and later
I was running Centos 5 and unable to load this module in httpd. Here is how i did it. The mod_substitute.so does not come preinstalled under modules so you have to copy the source of mod_substitute.c from the latest apache source and then compile it with apxs installer.
Yum install httpd httpd-devel php
Download the latest apache source tarball from httpd.apache.org. you need not compile it as httpd has already been installed with yum.
tar zxf httpd-2.2.9.tar.gz
cd modules/filters
cp mod_substitute.c /opt
then compile and install with apxs
apxs -cia mod_substitute.c
then open /etc/conf/httpd.conf and add a line like this…
LoadModule substitute_module modules/mod_substitute.so
This this is done, you have to setup mod_subsitute to do the filtering.
In .htaccess add lines like
AddOutputFilterByType SUBSTITUTE text/html
Substitute s/foo/bar/ni
or in httpd.conf
Substitute s/foo/bar/ni
Once this is done it replaces all foo with bar in html pages.
Similar Posts:
- Install ModSecurity for Redhat/Centos
- How to Install suPHP in Linux
- Enabling ModRewrite in XAMPP Apache
- Install LAMP Server for Centos/RHEL
- Apache Error Log File Path in Cpanel
- Fixing WordPress custom permalinks 404 error
- Perl modules CPAN error memory allocation
- How to Fix: PHPMyAdmin 403 Forbidden Error
- [Fix] Ziplib compile error with zziptest.c
- Easy Install FFmpeg in Linux


March 4, 2009
it can be usefull to change & with & in html page to make it w3c compliant