On Thu, Aug 21, 2008 at 05:04:30PM +1200, andrew wrote:
> Say I've got a site at:
> and I've mapped this to a domain (mysite.com) pointed to by an Apache
> rewrite rule:
> RewriteRule ^/(.+)
> %{HTTP_HOST}:80/++/$1 [L,P]

Warning: HTTP_HOST sometimes includes the port number.  It all depends
on what the browser sends you.

I'm also somewhat surprised to see you using (.+) rather than (.*).

> but I've now created a skin for the site that I want to point
> skin2.mysite.com at. The following rewrite rule works:
> RewriteRule ^/(.+)
> %{HTTP_HOST}:80/++/++skin++skin2/$1 [L,P]
> except that the skin URL component ends up in viewlet URLs, which sort
> of makes sense since it's after the virtual host stuff. However, it
> would be nice to get rid of the skin URL component altogether in page
> resources since it's being handled by Apache already.

> Also, I still want to be able to test the skin at:
> http://mysite.com/++skin++skin2/
> so in this case the skin component would have to stay there.
> I've tried moving the skin URL component before the virtual host
> component in the rewrite rule:
> RewriteRule ^/(.+)
> ++http:%{HTTP_HOST}:80/++/$1 [L,P]
> but when accessing, e.g., http://skin2.mysite.com/testpage I get:
> File
> '/opt/vortex/buildout/vortex/var/eggs/zope.publisher-3.4.1-py2.4.egg/zope/publisher/http.py',
>  line 568 in shiftNameToApplication
>   raise ValueError("Can only shift leading traversal "
> ValueError: Can only shift leading traversal names to application names
> Any ideas how I can have my cake and eat it too ? :-)

It's an intentional limitation of the ++skin++ directive: it is only
allowed at the very beginning of a URL (and, I think, due to an
implementation detail, just after the ++vh++ directive).  IIUC it's a
security measure: you don't want your users to switch to other skins
that may have views that shouldn't be available to them.

You can try

  RewriteRule ^/(.+){HTTP_HOST}:80/++/$1 


Marius Gedminas
MCSE == Marginal Computer Software Enthusiast

Attachment: signature.asc
Description: Digital signature

Zope3-users mailing list

Reply via email to