<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: How to use mod_rewrite rules to easily enable web site &#8220;maintenance&#8221; modes</title>
	<atom:link href="http://maymay.net/blog/2008/08/10/how-to-use-mod_rewrite-rules-to-easily-enable-web-site-maintenance-modes/feed/" rel="self" type="application/rss+xml" />
	<link>http://maymay.net/blog/2008/08/10/how-to-use-mod_rewrite-rules-to-easily-enable-web-site-maintenance-modes/</link>
	<description>The brutally honest, first-person account of Meitar Moscovitz&#039;s life.</description>
	<lastBuildDate>Mon, 21 May 2012 09:39:33 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Meitar</title>
		<link>http://maymay.net/blog/2008/08/10/how-to-use-mod_rewrite-rules-to-easily-enable-web-site-maintenance-modes/comment-page-1/#comment-141036</link>
		<dc:creator>Meitar</dc:creator>
		<pubDate>Fri, 16 Jan 2009 16:02:59 +0000</pubDate>
		<guid isPermaLink="false">http://maymay.net/blog/?p=574#comment-141036</guid>
		<description>&lt;a href=&quot;#comment-140282&quot; rel=&quot;nofollow&quot;&gt;Michael&lt;/a&gt;, The issue you describe with regards to not being able to copy-and-paste a solution because of surrounding settings is, unfortunately, universal to all environments. It&#039;s simply the nature of the beast. Your environment certainly sounds different than most.

As for not seeing any logs, note that Apache&#039;s rewriting engine uses a different logging mechanism than the generic logs for the rest of the server. To turn it on, use the &lt;a href=&quot;http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritelog&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;RewriteLog&lt;/code&gt; directive&lt;/a&gt;. I usually go all the way to &lt;code&gt;RewriteLogLevel 9&lt;/code&gt; and investigate that way, turning down the verbosity incrementally until the problem is resolved.</description>
		<content:encoded><![CDATA[<p><a href="#comment-140282" rel="nofollow">Michael</a>, The issue you describe with regards to not being able to copy-and-paste a solution because of surrounding settings is, unfortunately, universal to all environments. It&#8217;s simply the nature of the beast. Your environment certainly sounds different than most.</p>
<p>As for not seeing any logs, note that Apache&#8217;s rewriting engine uses a different logging mechanism than the generic logs for the rest of the server. To turn it on, use the <a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritelog" rel="nofollow"><code>RewriteLog</code> directive</a>. I usually go all the way to <code>RewriteLogLevel 9</code> and investigate that way, turning down the verbosity incrementally until the problem is resolved.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://maymay.net/blog/2008/08/10/how-to-use-mod_rewrite-rules-to-easily-enable-web-site-maintenance-modes/comment-page-1/#comment-140299</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Mon, 05 Jan 2009 04:08:50 +0000</pubDate>
		<guid isPermaLink="false">http://maymay.net/blog/?p=574#comment-140299</guid>
		<description>Well...it worked nicely on Windows.  On Linux...not so much.  I&#039;m sure something else in the Linux version of the conf file is causing it to fail.

Next up is seeing if there&#039;s a way to determine why it&#039;s failing in some explicit manner.  The log files are not showing me anything important.  It&#039;s like trying to fix a bug without any error message or the ability to set a breakpoint.  I&#039;m swinging in the dark right now.  

I can&#039;t tell if it&#039;s getting confused by an Alias, if I&#039;m not setting the right codes (R vs. PT), if ProxyPass is not playing nicely with it, or the regexp of the rule itself is a problem.  

sigh.</description>
		<content:encoded><![CDATA[<p>Well&#8230;it worked nicely on Windows.  On Linux&#8230;not so much.  I&#8217;m sure something else in the Linux version of the conf file is causing it to fail.</p>
<p>Next up is seeing if there&#8217;s a way to determine why it&#8217;s failing in some explicit manner.  The log files are not showing me anything important.  It&#8217;s like trying to fix a bug without any error message or the ability to set a breakpoint.  I&#8217;m swinging in the dark right now.  </p>
<p>I can&#8217;t tell if it&#8217;s getting confused by an Alias, if I&#8217;m not setting the right codes (R vs. PT), if ProxyPass is not playing nicely with it, or the regexp of the rule itself is a problem.  </p>
<p>sigh.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://maymay.net/blog/2008/08/10/how-to-use-mod_rewrite-rules-to-easily-enable-web-site-maintenance-modes/comment-page-1/#comment-140282</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Mon, 05 Jan 2009 00:49:34 +0000</pubDate>
		<guid isPermaLink="false">http://maymay.net/blog/?p=574#comment-140282</guid>
		<description>After a bit of experimenting, I got it to work.

A few things made the journey a bit longer than it should have been.   :-)

1.  This rewrite rule (from above) didn&#039;t work for me:

RewriteRule !^down-for-maintenance/.*$ /down-for-maintenance/ [R,L]

It would put me in an endless loop.

Instead, I put a leading backslash into it as follows:

RewriteRule !^/down-for-maintenance/.*$ /down-for-maintenance/ [R,L]    

I can&#039;t explain why but it works.

2.  I&#039;m using ProxyPass and I had to put these rewrite rules above it.

3.  I had to allow for an exception with the down-for-maintenance page as follows:

ProxyPass /down-for-maintenance ! 

----------

The only thing that doesn&#039;t work is testing for my IP.  I get the maintenance page no matter what (when turned on).  I&#039;d like that feature to work, but I can do without it.  

The big learning lesson here:  Some (many?) Apache rules are contextual.  You just can&#039;t copy and paste a solution in because the surrounding settings in your httpd.conf may influence the solution you paste in.  What works on one server may not work on another without understanding the rest of the settings in place.

Also, keep in mind your FF/IE browser cache.  At one point, I thought I had something working and hit Ctrl-F5 on FF and was caught by surprise that it really wasn&#039;t working.

So, where I stand now:  The essence of the suggested solution above works nicely.  I can toggle the maintenance page on or off by simply renaming it. It&#039;s simple and elegant.  

Michael.</description>
		<content:encoded><![CDATA[<p>After a bit of experimenting, I got it to work.</p>
<p>A few things made the journey a bit longer than it should have been.   :-)</p>
<p>1.  This rewrite rule (from above) didn&#8217;t work for me:</p>
<p>RewriteRule !^down-for-maintenance/.*$ /down-for-maintenance/ [R,L]</p>
<p>It would put me in an endless loop.</p>
<p>Instead, I put a leading backslash into it as follows:</p>
<p>RewriteRule !^/down-for-maintenance/.*$ /down-for-maintenance/ [R,L]    </p>
<p>I can&#8217;t explain why but it works.</p>
<p>2.  I&#8217;m using ProxyPass and I had to put these rewrite rules above it.</p>
<p>3.  I had to allow for an exception with the down-for-maintenance page as follows:</p>
<p>ProxyPass /down-for-maintenance ! </p>
<p>&#8212;&#8212;&#8212;-</p>
<p>The only thing that doesn&#8217;t work is testing for my <acronym title="Internet Protocol">IP</acronym>.  I get the maintenance page no matter what (when turned on).  I&#8217;d like that feature to work, but I can do without it.  </p>
<p>The big learning lesson here:  Some (many?) Apache rules are contextual.  You just can&#8217;t copy and paste a solution in because the surrounding settings in your httpd.conf may influence the solution you paste in.  What works on one server may not work on another without understanding the rest of the settings in place.</p>
<p>Also, keep in mind your FF/IE browser cache.  At one point, I thought I had something working and hit Ctrl-F5 on FF and was caught by surprise that it really wasn&#8217;t working.</p>
<p>So, where I stand now:  The essence of the suggested solution above works nicely.  I can toggle the maintenance page on or off by simply renaming it. It&#8217;s simple and elegant.  </p>
<p>Michael.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://maymay.net/blog/2008/08/10/how-to-use-mod_rewrite-rules-to-easily-enable-web-site-maintenance-modes/comment-page-1/#comment-140272</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Sun, 04 Jan 2009 22:35:52 +0000</pubDate>
		<guid isPermaLink="false">http://maymay.net/blog/?p=574#comment-140272</guid>
		<description>Hi Meitar,

I thought you&#039;d find this interesting...

I tried putting your rewrite rules in play and ran into some problems.  I&#039;m not sure why.  But anyway, I had previously bookmarked a few other pages on the net related to the same topic and I went to take a peek to see the difference in rules to get a feel for the issue at hand. 

One of them is (was?) this:

(don&#039;t visit it yet)

http://www.techiecorner.com/97/redirect-to-maintenance-page-during-upgrade-using-htaccess/

Before you go there, understand that that site has been hacked.  I thought it was a joke, but I googled the hacker&#039;s name (not putting it here so it doesn&#039;t show up on a googlebot crawl) and it seems this guy is hitting a lot of sites.  It seems like a mini epidemic with this guy.  

He even managed to effect the google cache of the page he hits.  

Anyways...he seems to hit PHP sites and since you&#039;re running Wordpress, I thought I&#039;d pass this on to you to give you a chance to lock down your site just in case.

Cheers...

Michael.</description>
		<content:encoded><![CDATA[<p>Hi Meitar,</p>
<p>I thought you&#8217;d find this interesting&#8230;</p>
<p>I tried putting your rewrite rules in play and ran into some problems.  I&#8217;m not sure why.  But anyway, I had previously bookmarked a few other pages on the net related to the same topic and I went to take a peek to see the difference in rules to get a feel for the issue at hand. </p>
<p>One of them is (was?) this:</p>
<p>(don&#8217;t visit it yet)</p>
<p><a href="http://www.techiecorner.com/97/redirect-to-maintenance-page-during-upgrade-using-htaccess/" rel="nofollow">http://www.techiecorner.com/97/redirect-to-maintenance-page-during-upgrade-using-htaccess/</a></p>
<p>Before you go there, understand that that site has been hacked.  I thought it was a joke, but I googled the hacker&#8217;s name (not putting it here so it doesn&#8217;t show up on a googlebot crawl) and it seems this guy is hitting a lot of sites.  It seems like a mini epidemic with this guy.  </p>
<p>He even managed to effect the google cache of the page he hits.  </p>
<p>Anyways&#8230;he seems to hit <acronym title="PHP Hypertext Preprocessor; an HTML-embedded scripting language">PHP</acronym> sites and since you&#8217;re running WordPress, I thought I&#8217;d pass this on to you to give you a chance to lock down your site just in case.</p>
<p>Cheers&#8230;</p>
<p>Michael.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Meitar</title>
		<link>http://maymay.net/blog/2008/08/10/how-to-use-mod_rewrite-rules-to-easily-enable-web-site-maintenance-modes/comment-page-1/#comment-140245</link>
		<dc:creator>Meitar</dc:creator>
		<pubDate>Sun, 04 Jan 2009 10:10:43 +0000</pubDate>
		<guid isPermaLink="false">http://maymay.net/blog/?p=574#comment-140245</guid>
		<description>Hey Michael, I&#039;m glad you liked this. :) I don&#039;t want to vouch for the rest of my blog posts but if you do find other things valuable I hope you&#039;ll let me know. For that matter, feel free to let me know how to improve on less-than-valuable posts as well. Constructive feedback is always appreciated.</description>
		<content:encoded><![CDATA[<p>Hey Michael, I&#8217;m glad you liked this. :) I don&#8217;t want to vouch for the rest of my blog posts but if you do find other things valuable I hope you&#8217;ll let me know. For that matter, feel free to let me know how to improve on less-than-valuable posts as well. Constructive feedback is always appreciated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://maymay.net/blog/2008/08/10/how-to-use-mod_rewrite-rules-to-easily-enable-web-site-maintenance-modes/comment-page-1/#comment-140244</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Sun, 04 Jan 2009 09:57:55 +0000</pubDate>
		<guid isPermaLink="false">http://maymay.net/blog/?p=574#comment-140244</guid>
		<description>Hey Meitar,

This is a nice solution.  I&#039;ve seen others attempt the same thing but with more steps and less instructions on how to implement it (other than a &quot;use this&quot;).  Your step by step explanation is really helpful.  

I&#039;m bookmarking your site.  If the rest of your articles are as well done as this, I should have some fun reading and might learn a few things along the way.

I wish I had done this prior to throwing the site up (I need a curtain to implement the curtain).  

:-)

Still, I&#039;ll give is a test run on a local apache installation before putting it on the server.

Once again, thanks...

Michael.</description>
		<content:encoded><![CDATA[<p>Hey Meitar,</p>
<p>This is a nice solution.  I&#8217;ve seen others attempt the same thing but with more steps and less instructions on how to implement it (other than a &#8220;use this&#8221;).  Your step by step explanation is really helpful.  </p>
<p>I&#8217;m bookmarking your site.  If the rest of your articles are as well done as this, I should have some fun reading and might learn a few things along the way.</p>
<p>I wish I had done this prior to throwing the site up (I need a curtain to implement the curtain).  </p>
<p>:-)</p>
<p>Still, I&#8217;ll give is a test run on a local apache installation before putting it on the server.</p>
<p>Once again, thanks&#8230;</p>
<p>Michael.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

