# .htaccess rewrite rule to mongrel rewrite rule

**URL:** <https://www.ruby-forum.com/t/htaccess-rewrite-rule-to-mongrel-rewrite-rule/194097>\
**Category:** Mongrel\
**Created:** [August 30, 2010, 10:19am UTC](https://www.ruby-forum.com/t/htaccess-rewrite-rule-to-mongrel-rewrite-rule/194097 "2010-08-30T10:19:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rapbhan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e47774/32.png) [@rapbhan](https://www.ruby-forum.com/u/rapbhan)\
**Post date:** [August 30, 2010, 10:19am UTC](https://www.ruby-forum.com/t/htaccess-rewrite-rule-to-mongrel-rewrite-rule/194097/1 "2010-08-30T10:19:46Z")

</div>

Hi All,

The application is running on mongrel cluster and its used to serve  
different contents for each domain and I had implemented the cache per  
domain level using the below plugin:

> **[GitHub - yeah/page\_cache\_fu: PageCacheFu adds the following missing features...](https://github.com/yeah/page_cache_fu)**
>
> PageCacheFu adds the following missing features to Rails page caching: expiry time for cached pages, different caches for different hostnames (e.g. subdomains), and different caches for query strin...

Now the problem is, since the mongrel bypasses the .htaccess  
configuration and I am new to mongrel rewrite rule. So it would be of  
great help, if you can let me know the right rewrite rule for mongrel  
for the below .htaccess

RewriteMap uri\_escape int:escape  
\<Directory /path/to/my/rails\_app/public/\>  
RewriteEngine On  
RewriteCond %{REQUEST\_METHOD} GET [NC]  
RewriteCond  
%{DOCUMENT\_ROOT}/cache/%{HTTP\_HOST}%{REQUEST\_URI}%{QUERY\_STRING}.html -f  
RewriteRule ^([^.]+)$  
cache/%{HTTP\_HOST}/$1${uri\_escape:%{QUERY\_STRING}}.html [L]

```
  RewriteCond %{REQUEST_METHOD} GET [NC]
  RewriteCond %{DOCUMENT_ROOT}/cache/%{HTTP_HOST}/index.html -f
  RewriteRule ^$ cache/%{HTTP_HOST}/index.html
</Directory>

```

Please do let me know.

Thank you for your helps!

Paddy
