[Mongrel] Apache Re-Write and Directories

Charles Brian Quinn me at seebq.com
Tue Oct 3 13:21:03 EDT 2006


Nicely done -- I'll add this to apache page!

# if the directory exists, add trailing slash
>    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} -d
>    RewriteRule ^(.+[^/])$ $1/ [R]



On 10/3/06, Philip Hallstrom <mongrel at philip.pjkh.com> wrote:
> > I am using the 'default' Apache 2.2 mod_rewrite rules suggested from the Web
> > site and they are working.
> >
> > One thing related to static (non cluster directed) resources:
> >
> > If I have a directory in public called 'static', if I request it as follows:
> >
> > http://www.domain.com/static/  - then it works
> >
> > If I request it as:
> >
> > http://www.domain.com/static - then it does not work as it gets directed to
> > the cluster.
> >
> > How can I change my rewrite rules to have both of the above URLs be served
> > by the static resource via Apache, not by Mongrel?
>
> Add this to the beginning...
>
>    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} -d
>    RewriteRule ^(.+[^/])$ $1/ [R]
>
>
>
> >
> > Rewrite rules:
> >
> >  RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
> >  RewriteCond %{SCRIPT_FILENAME} !maintenance.html
> >  RewriteRule ^.*$ /maintenance.html [L]
> >  # Rewrite index to check for static index.html
> >  RewriteRule ^/$ /index.html [QSA]
> >  # Rewrite to check for Rails cached pages with .html extentions
> >  RewriteRule ^([^.]+)$ $1.html [QSA]
> >  # All dynamic requests get sent to the cluster
> >  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
> >  RewriteRule ^/(.*)$ balancer://cluster%{REQUEST_URI} [P,QSA,L]
> >
> > Thanks!!!
> >
> > Hunter
> >
> >
> > _______________________________________________
> > Mongrel-users mailing list
> > Mongrel-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/mongrel-users
> >
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users
>


-- 
Charles Brian Quinn
self-promotion: www.seebq.com
highgroove studios: www.highgroove.com
slingshot hosting: www.slingshothosting.com


More information about the Mongrel-users mailing list