I defined a path variable in my httpd.conf:

Define OOSPATH D:/oos

This define can be used anywhere in the httpd.conf or files which are included from there. The same path needs to be used in a Rewrite rule, but unfortunately I can not use the variable, regardless of how I specify it. Both these variants fail:

RewriteEngine On
RewriteCond "${OOSPATH}/outofservice" -f
RewriteRule (.*) /strike.html [R=503,L]

RewriteEngine On
RewriteCond ${OOSPATH}/outofservice -f
RewriteRule (.*) /strike.html [R=503,L]

Apache complains about a missing variable:

[core:warn] [pid 5032:tid 1320] AH00111: Config variable ${OOSPATH} is not defined

However if I hardcode the path, this works fine:

RewriteEngine On
RewriteCond "D:/oos/outofservice" -f
RewriteRule (.*) /strike.html [R=503,L]

How can I have .htaccess inherit the define ?

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.