Using apache's IfDefine for dev and production environments

If you need different .htaccess directives depending on your development environment, you can do it like so:

<IfDefine dev>
# do something for development environment

<IfDefine !dev>
# do something for everywhere but the development environment

The trick is setting the variables. Contrary to common sense, using SetEnvIf does NOT work:

SetEnvIf Host ^dev.* dev

Instead, you have to pass the flag to apache on startup.

Syndicate content