is it possible to conditionally include another file in the htaccess file. When i work locally my apache settings are different from my remote server.
Each time i pull in changes through git to the stage site (which shares the same settings as the live server) i have to apply a patch to my htaccess:
diff --git a/.htaccess b/.htaccess
index 4733ffa..1b39d24 100644
--- a/.htaccess
+++ b/.htaccess
@@ -2,6 +2,15 @@
# Apache/PHP/Drupal settings:
#
+############################################
+## uncomment these lines for CGI mode
+## make sure to specify the correct cgi php binary file name
+## it might be /cgi-bin/php-cgi
+
+ Action php5-cgi /cgi-bin/php5-cgi
+ AddHandler php5-cgi .php
+
+
Is there a way to conditionally include this into my htaccess file. Thus, i could just gitignore this particular include file.
I could do a git hook but i'm not well versed and not interested in investing time at this moment to learn that.
P.S. if you're curious what my patch does is it provides the stage server directives as to where to run php as cgi.
Apache allows
<IfDefine>
and<IfModule>
directives within.htaccess
files.If you want to use
<IfDefine>
then Apache needs to be started ashttpd -Dsomedefinition
. See here.<IfModule>
is useful if you only want certain directives to be enabled if a given Apache module is loaded (e.g. if mod_perl has been loaded). See here..htaccess does not support the use of the Include directive, period.
What you should do instead is define the php action in httpd.conf on the staging server.
This will be a global setting if it is not overridden anywhere downstream.