How Can I Have A Conditional .htaccess Block?

前端 未结 4 1997
说谎
说谎 2020-12-05 05:47

This is an Apache question you\'ve probably come across before. I want to have one source package that I can deploy to my workstation, my staging server, and my production s

4条回答
  •  盖世英雄少女心
    2020-12-05 06:09

    I tried the IfDefine method and it didn't work, even though the defined variable i'd passed into the Apache startup was definitely showing up in phpinfo() on the APACHE_ARGUMENTS line.

    I tried another method and it worked perfectly. In your .htaccess file you need something like:

    # Is the domain local (i wanted to check two names)? # I wanted to password protect the production server only AuthType Basic AuthName "Restricted area" AuthUserFile /app/.htpasswd require valid-user

    I'm using Apache 2.4. Might not work for earlier versions.

提交回复
热议问题