Dev Apache Re-Write for www domain

So many times we need to make copies of our site to dev, but having to manipulate the code/hostname/vhost etc every damn time or setting up .hosts files to point to the dev IP is a pain to say the least.

So here’s my solution for apache2, make all www. addresses convert to dev. addresses, now I can browse my production and dev sites at the same time without 2 machines.

LoadModule substitute_module modules/
LoadModule filter_module modules/
FilterDeclare DEV
FilterProvider DEV SUBSTITUTE resp=Content-Type $text/


<VirtualHost *:80>
ProxyRequests Off
ProxyPreserveHost Off
ProxyPass /
ProxyPassReverse /
RequestHeader set Host “”
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all

<Location />
ProxyPassReverse /
RequestHeader unset Accept-Encoding
FilterChain DEV
Substitute “s|||inq”

That is all.

I upgraded my script for HTTP/2 compatibility to use FilterChain, here’s the old command.

# AddOutputFilterByType SUBSTITUTE text/html
# Substitute “s|||inq”

Say Something Nice