On Mon, 2001-12-10 at 00:12, Tavis Rudd wrote:
> On Sunday 09 December 2001 11:05, Tim Payne wrote:
> > On Sunday, December 9, 2001, at 11:04 AM, Chuck Esterbrook wrote:
> > > In the mean time (if you're up to tracking it down), can
> > > mod_rewrite get you what you need with minimal effort?
> > Using this I was able to get 127.0.0.1 to forward to
> > 127.0.0.1/wk/MySite
> > RewriteEngine on
> > RewriteRule ^/$ /wk/MySite/ [R]
> > That works for now, but I would really like to have the forwarded
> > url still use 127.0.0.1 as the base url, just accessing the files
> > from /wk/MySite. I looked though the mod_rewrite docs, but I
> > couldn't find a way to do this.
> RewriteRule ^/.*$ /wk/MySite/ [R]
> or something like that should do it, BUT you can't do any non webkit
> stuff from Apache with this configuration.
> A better approach would be to map each sub directory in your Servlet
> dir with multiple RewriteRules:
> RewriteRule ^/Products/.*$ /wk/MySite/Products/ [R]
> RewriteRule ^/Services/.*$ /wk/MySite/Services/ [R]
There should also be a way to trap static files. Perhaps like:
RewriteRule ^(.*\.jpg)$ $1 [L]
RewriteRule ^(.*\.)(html|gif|jpg|png|zip|tar\.gz) $1$2 [L]
I'm not sure if you need to put /path/to/root/$1 on the second
argument... maybe Apache will pick it up from your DocumentRoot, but I'm
> Using mod_rewrite is the only way to make this work with WebKit 0.6.
> It expects the name of the servlet files to be stored in the
> PATH_INFO cgi field, rather than in SCRIPT_NAME:
> is rewritten to:
> which WebKit sees as
> SCRIPT_NAME = "/wk/MySite"
> PATH_INFO = "/MyServlet.py"
> I've been writing some experimental code that allows WebKit to use
> SCRIPT_NAME instead, but that code is a while off from
> completion/acceptance. If WebKit 0.7 supports this, you'd just use
> AddHandler mod_webkit *.py
> AddHandler mod_webkit *.psp
Well, as I think of it, it should be possible to route all requests that
*don't* have any extension to Webware. I totally haven't tested this,
but maybe something like:
RewriteRule ^(.*)/([^/?.]+)?(.*) /wk/MySite/$1/$2?$3 [L,PT]
RewriteRule ^(.*)/([^/?.]+) /wk/MySite/$1/$2 [L,PT]
Unfortunately, this won't work for directories, since Webware requests
are indistinguishable from index.html requests. But, it has a lot of
the advantages of AddHandler, without introducing extensions, and being
largely backward compatible (except for README files and the like).
If you don't use Main.py/index.py, then it should work better as well.
You could also put in special rewrite rules for those cases you want to
support as well.
Some of this is covered on the Wiki:
If someone has some (tested) experience with mod_rewrite, I'd appreciate
it if they could check those examples and add some more.