<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CodeSanity &#187; apache</title>
	<atom:link href="http://codesanity.net/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://codesanity.net</link>
	<description>PHP, Javascript &#38; Technology Ramblings</description>
	<lastBuildDate>Wed, 07 Jul 2010 00:28:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Conditional .Htpasswd for Multi-Environment Setups</title>
		<link>http://codesanity.net/2009/11/conditional-htpasswd-multienvironment-setups/</link>
		<comments>http://codesanity.net/2009/11/conditional-htpasswd-multienvironment-setups/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 08:58:47 +0000</pubDate>
		<dc:creator>Tom Schlick</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[conditional]]></category>
		<category><![CDATA[environments]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[htpasswd]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://codesanity.net/?p=125</guid>
		<description><![CDATA[When using a Multi-Environment setup for your development process it is essential to have adequate protection from outside prying eyes, but also allow people to access your public/testing sites. This .htaccess code allows you to do that.]]></description>
			<content:encoded><![CDATA[<p>So a while back i set Chris over at <a href="http://css-tricks.com" target="_blank">CSS-Tricks</a> some code for his ongoing <a href="http://css-tricks.com/snippets/" target="_blank">snippet library</a> project. This is a quick explanation of that code.</p>
<p>You see when you are working with a multi-environment setup that is synced via a version control system such as Git or Subversion, you need a way to keep your development environments locked down while allowing access to your public environment.</p>
<p>Below is some text that you will input into a .htaccess file placed in your webroot</p>
<p>[sourcecode language='php']<br />
#allows a single uri through the .htaccess password protection<br />
SetEnvIf Request_URI &#8220;/testing_uri$&#8221; test_uri</p>
<p>#allows everything if its on a certain host<br />
SetEnvIf HOST &#8220;^testing.yoursite.com&#8221; testing_url<br />
SetEnvIf HOST &#8220;^yoursite.com&#8221; live_url<br />
Order Deny,Allow</p>
<p>AuthName &#8220;Restricted Area&#8221;<br />
AuthType Basic<br />
AuthUserFile /path/to/your/.htpasswd<br />
AuthGroupFile /<br />
Require valid-user</p>
<p>#Allow valid-user<br />
Deny from all<br />
Allow from env=test_uri<br />
Allow from env=testing_url<br />
Allow from env=live_url<br />
Satisfy any<br />
[/sourcecode]</p>
<p>so in the above code the &#8220;testing_uri&#8221; part could be if i only wanted to allow this url through my htaccess protections (useful for paypal pings) ex &#8220;http://mysite.com/paypal/ipn&#8221;</p>
<p>the host part is to allow anyone through if they are requesting the code from a specific domain such as &#8220;testing.yoursite.com&#8221;. if it is &#8220;development.yoursite.com&#8221; it will not allow the user through.</p>
<p><a href="http://css-tricks.com/snippets/htaccess/allow-single-url/" target="_blank">here is the code on css-tricks</a> and <a href="http://gist.github.com/229178" target="_blank">here is the code as a github gist</a></p>
<p>Thanks for reading and as always comments &amp; questions are heavily encouraged!</p>
]]></content:encoded>
			<wfw:commentRss>http://codesanity.net/2009/11/conditional-htpasswd-multienvironment-setups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)
Content Delivery Network via Amazon Web Services: S3: assets.codesanity.net.s3.amazonaws.com

Served from: codesanity.net @ 2010-09-06 07:09:48 -->