[Project_owners] Replacement for mozdev.org templates

Michael Vincent van Rantwijk, MultiZilla mv_van_rantwijk at yahoo.com
Tue Jul 1 08:51:14 PDT 2008


Douglas E. Warner wrote:
> On Monday 30 June 2008 17:32:07 Michael Vincent van Rantwijk, MultiZilla 
> wrote:
>>> Oh dear. Apache's dreadful mod_rewrite I just got to master this one day
>>> soon.
>> Note: mod_rewrite works.  I've added a few test rules to rewrite
>> sites/pages but I am still trying to solve the puzzle for the above
>> rewrite.
> 
> Our mod_rewrite rules are pretty complicated right now; here are some snippets 
> that deal with the templating system that might help with things.
> 
> -Doug
> 
> RewriteRule .* - [E=MZ_HTTP_HOST:%{HTTP_HOST}]
> RewriteCond %{ENV:MZ_HTTP_HOST} ^([^.]+)\.(mozdev|vebzom)\.org(:[0-9]+)?\.?$ 
> [NC]
> RewriteRule ^ - [E=VHOST:${lowercase:%1},S=1]
> RewriteRule ^ - [E=VHOST:www]
> 
> RewriteRule ^/$ /php/index.php?project=%{ENV:VHOST}&page=index.html [L]
> RewriteRule ^/(.+\.html?)$ /php/index.php?project=%{ENV:VHOST}&page=$1 [L]
> RewriteRule ^(.+/)$ /php/index.php?project=%{ENV:VHOST}&page=$1index.html [L]
> RewriteCond %{DOCUMENT_ROOT}/%{ENV:VHOST}/www%{REQUEST_URI} -f
> RewriteRule ^(.*)$ /%{ENV:VHOST}/www$1 [L,PT]

Okay, that looks promising. Thus the URL:
http://multizilla.mozdev.org/news/news.html
should set the following environmental variables:

MZ_HTTP_HOST	= multizilla.mozdev.org
VHOST		= multizilla

and the following server vars to:

HTTP_HOST	= multizilla.mozdev.org
DOCUMENT_ROOT	= /mozdev/sandbox/data/helm/htdoc
REQUEST_URI	= /news/news.html

Your second RewriteCond seems to be included for scripting,
but I can be wrong of course.

I do wonder if this changes the browsers location bar to something like:
sub.domain.tlc/index.php?project=multizilla&page=/news/news.html ???

Thanks again!

Michael


More information about the Project_owners mailing list