List Info

Thread: Subdomains and URLRewrite




Subdomains and URLRewrite
user name
2006-05-10 20:05:46
So I finally got to spend some time playing around with my
goal to host 
different blojsom blogs on the roots of different
subdomains. It's 
basically working now, so I thought I'd share some details
about what 
I'm doing.

First of all, the problem. I want these URLs:

http://eric.synclastic.com

http://push.synclastic.com

http://writing.synclast
ic.com

to be separate blogs, without wasting too many resources on
the host.

What I've done is configured my Apache-Tomcat combo to
route these 
subdomains to the same root webapp on www.synclastic.com and
have 
installed blojsom as "/blog" under there. I then
created three blogs 
called "eric", "push" and
"writing". Each blog uses the appropriate 
subdomain for its blog-url property, meaning that they get
accessed like 
this:

http://eric.syn
clastic.com/blog/eric/
http://push.syn
clastic.com/blog/push/
http://wr
iting.synclastic.com/blog/writing/

Now that's kind of redundant. So I installed the URLRewrite
filter 
(http://tuckey.org/urlre
write/) and defined rules like so:

<rule>
   <condition
name="host">eric.synclastic.com</condition
>
   <from>^/$</from>
   <to>/blog/eric/</to>
</rule>

<rule>
   <condition
name="host">eric.synclastic.com</condition
>
   <from>^/([^/]*)\.html$</from>
   <to>/bnet/eric/?permalink=$1.html</to>
</rule>

<rule>
   <condition
name="host">eric.synclastic.com</condition
>
   <from>^/([^/]*)\.html\?(.*)$</from>
  
<to>/bnet/eric/?permalink=$1.html&amp;$2</to>
;
</rule>

This means that

eric.synclastic.com
= eric.synclastic.com/blog/eric/

eric.synclastic.com/foo.html
= eric.synclastic.com/blog/eric/?permalink=foo.html

eric.synclastic.com/foo.html?page=comments
=
eric.synclastic.com/blog/eric/?peramlink=foo.html&page=c
omments

Note that I still have to define rules for entries-by-date,
if I 
actually want that feature.

So far things are working well. URLRewrite lets you define
output 
filters that trap calls to encode URLs and rewrite them on
the way out, 
so I should be able to write rules to take permalinks and
convert them 
to the simpler form. If that doesn't work, I'll just whack
the templates 
directly to do the right thing.

To administer, you just use the usual
/blog/eric/?flavor=admin syntax. 
The only trick to all this is that you can't have any HTML
files in the 
root directory, but you can definitely have them in
subdirectories.

I'll write up a longish posting about all of this when I
have it working 
well enough.

Eric


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web
services, security?
Get stuff done quickly with pre-integrated technology to
make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on
Apache Geronimo
http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Blojsom-users mailing list
Blojsom-userslists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/blojsom-u
sers
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )