यह कोड मल्टी एनवायरनमेंट सेटअप (स्टेजिंग, प्रोडक्शन, आदि) के लिए उपयोगी है। यह आपको अपने डेवलपमेंट एनवायरनमेंट या लाइव वातावरण के बारे में एक htpasswd को बनाए रखते हुए अपनी htaccess फाइलों को सिंक में रखने की अनुमति देता है।
#allows a single uri through the .htaccess password protection SetEnvIf Request_URI "/testing_uri$" test_uri #allows everything if its on a certain host SetEnvIf HOST "^testing.yoursite.com" testing_url SetEnvIf HOST "^yoursite.com" live_url Order Deny,Allow AuthName "Restricted Area" AuthType Basic AuthUserFile /path/to/your/.htpasswd AuthGroupFile / Require valid-user #Allow valid-user Deny from all Allow from env=test_uri Allow from env=testing_url Allow from env=live_url Satisfy any