rhodesa Posted February 13, 2009 Share Posted February 13, 2009 Heys guys, as a developer I'll usually have a local copy of a site I'm working on and then the copy that is in production. Since the environments are different, sometimes they need to be slightly different (paths usually). I'm all set on doing conditionals in the PHP code of the site, but I can't figure out how to do conditionals for Apache Configs. For instance, if I am using HTTP Basic Auth, on my local system the line might look like: AuthUserFile /usr/local/apache/passwd/passwords while on my production server it might be: AuthUserFile /home/useracct/hostname.com/passwords Is there a way to test the HOST or SERVER name to determine which line to use dynamically? Quote Link to comment https://forums.phpfreaks.com/topic/145074-solved-if-statements-in-htaccess/ Share on other sites More sharing options...
corbin Posted February 13, 2009 Share Posted February 13, 2009 http://httpd.apache.org/docs/2.2/mod/mod_setenvif.html Might work...... Or just an if, but I have no idea. Quote Link to comment https://forums.phpfreaks.com/topic/145074-solved-if-statements-in-htaccess/#findComment-761359 Share on other sites More sharing options...
rhodesa Posted February 13, 2009 Author Share Posted February 13, 2009 well...just to let everyone know... i couldn't find anything designed for it, but i was able to work around it by using <IfModule>. i compared the list of loaded modules between the two servers and found a module that was on one but not the other. then, i used this: AuthType Basic AuthName "Protected" Require valid-user <IfModule prefork.c> #Mini AuthUserFile /www/websites/foobar/admin/.htpasswd </IfModule> <IfModule !prefork.c> #arhodes AuthUserFile "C:\webserver\eclipse_ws\foobar\admin\.htpasswd" </IfModule> not what it was designed for...but it works Quote Link to comment https://forums.phpfreaks.com/topic/145074-solved-if-statements-in-htaccess/#findComment-761450 Share on other sites More sharing options...
corbin Posted February 13, 2009 Share Posted February 13, 2009 Ghetto as can be, but what ever works ;p. Quote Link to comment https://forums.phpfreaks.com/topic/145074-solved-if-statements-in-htaccess/#findComment-761454 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.