# Rewriterule muck up

**URL:** <https://www.ruby-forum.com/t/rewriterule-muck-up/103746>\
**Category:** Rails\
**Created:** [May 9, 2007, 9:13pm UTC](https://www.ruby-forum.com/t/rewriterule-muck-up/103746 "2007-05-09T21:13:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 9, 2007, 9:13pm UTC](https://www.ruby-forum.com/t/rewriterule-muck-up/103746/1 "2007-05-09T21:13:41Z")

</div>

ok, want to have my nice rails/mongrel app show a maint page when  
available…

trying to do something like this…  
[http://jonathan.tron.name/articles/2006/07/26/apache-2-0-x-mongrel-mod\_proxy-mod\_rewrite-configuration](http://jonathan.tron.name/articles/2006/07/26/apache-2-0-x-mongrel-mod_proxy-mod_rewrite-configuration)

my vhost rewrite rules are…  
RewriteEngine On  
RewriteLog /var/log/apache2/rewrite\_engine\_log  
RewriteLogLevel 3  
RewriteCond %{DOCUMENT\_ROOT}/maintenance.html -f  
RewriteCond %{SCRIPT\_FILENAME} !maintenance.html  
RewriteRule ^.\*$ /maintenance.html [L]

my rewrite log is…  
127.0.0.1 - - [09/May/2007:13:55:07 --0500] [/sid#81d0960][rid#836a748/  
initial] (1) pass through /  
127.0.0.1 - - [09/May/2007:13:58:11 --0500] [/sid#81d0960][rid#836a748/  
initial] (2) init rewrite engine with requested uri /  
127.0.0.1 - - [09/May/2007:13:58:11 --0500] [/sid#81d0960][rid#836a748/  
initial] (3) applying pattern ‘^.\*$’ to uri ‘/’  
127.0.0.1 - - [09/May/2007:13:58:11 --0500] [/sid#81d0960][rid#836a748/  
initial] (1) pass through /

SOOO…it just passes on thru everything, uggg

Any Rewrite experts out there ?

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 9, 2007, 9:43pm UTC](https://www.ruby-forum.com/t/rewriterule-muck-up/103746/2 "2007-05-09T21:43:45Z")

</div>

> [http://jonathan.tron.name/articles/2006/07/26/apache-2-0-x-mongrel-mod\_proxy-mod\_rewrite-configuration](http://jonathan.tron.name/articles/2006/07/26/apache-2-0-x-mongrel-mod_proxy-mod_rewrite-configuration)
> 
> my vhost rewrite rules are…  
> RewriteEngine On  
> RewriteLog /var/log/apache2/rewrite\_engine\_log  
> RewriteLogLevel 3  
> RewriteCond %{DOCUMENT\_ROOT}/maintenance.html -f  
> RewriteCond %{SCRIPT\_FILENAME} !maintenance.html  
> RewriteRule ^.\*$ /maintenance.html [L]

You have a typo… or at least don’t have the same code he has… his  
file  
is in the /system directory… Here’s the configs I’ve used in the past  
that have worked for me when public/system/maintenance.html exists…

# Check for maintenance file and redirect all requests

# ( this is for use with Capistrano’s disable\_web task )

RewriteCond %{DOCUMENT\_ROOT}/system/maintenance.html -f  
RewriteCond %{SCRIPT\_FILENAME} !maintenance.html  
RewriteRule ^.\*$ /system/maintenance.html [L]

-philip

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 11, 2007, 4:41am UTC](https://www.ruby-forum.com/t/rewriterule-muck-up/103746/3 "2007-05-11T04:41:01Z")

</div>

Yeah, I have mine in public/maintenance.html, I did try moving it to  
system under he superstition that maybe that mattered, but it did  
not. The really confusing thing is that the rewrite log says  
"comparing to /^.\*$/ (ie everything), and then passing thru, come on,  
it’s gotta match !
