Thanks for the info and clarification. I'm exploring a bit on this myself, now. I want to look at rule construction some more though, even though I now understand why what I listed was a bad choice. It's getting kind of hacked up with all of the replies, so here's your original, as copied from http://lists.zope.org/pipermail/zope/2002-January/107176.html :
I use an extra condition to avoid that problem and do another rewrite if hostname has the port appended:
RewriteCond %{HTTP_HOST} ^.*:80$ RewriteRule ^/(.*) http://localhost:25080/zopefolder/VirtualHostBase/http/%{HTTP_HOST}/VirtualH ostRoot/$1 [P] http://localhost:25080/zopefolder/VirtualHostBase/http/%{HTTP_HOST}/VirtualH ostRoot/$1 [P] Is that last line doubled by accident? Or is it supposed to look a little different? Assuming that the last line should be deleted or changed, then that makes sense. I've been experimenting today with the following slight modification, with some success, though, and it seems like a more generic solution to me. Here it is based on what you were using (mine actually looks different, because I am using my own product, but here it is with you code): RewriteCond %{HTTP_HOST} ^.*:\d*$ RewriteRule ^/(.*) http://localhost:25080/zopefolder/VirtualHostBase/http/%{HTTP_HOST}/VirtualH ostRoot/$1 [P] RewriteRule ^/(.*) http://localhost:25080/zopefolder/VirtualHostBase/http/%{HTTP_HOST}:%{SERVER _PORT}/VirtualHostRoot/$1 [P] That's assuming SERVER_PORT is reliable, which it has been in my tests today. This performed satisfactorily today for me with IE, Moz, and WebDAV, using multiple http ports (ok, well, two, one normal and one webdav source). BTW, of my initial attempt, you end with this:
This might be desired in some cases (locking out wget&friends) , but will end in a disaster if a popular browser begins to send the "Host:" header this way.
I'm not sure, but the latest nightly Mozilla build may be doing this exact thing. I got some results that seemed to suggest that. Interesting. Thanks for bringing this up. Gary