Jo Meder wrote:
Am 23.10.2002, 20:23 Uhr schrub Dieter Maurer <dieter@handshake.de>:
Some HTTP clients include the port in the "HOST" HTTP header.
Use an Apache "RewriteCond" to strip away the port if it is present:
RewriteCond %{HTTP_HOST} ([^:]*)(:.*)? RewriteRule ..../http/%1:80/...
Looks good, thanks a lot.
So far I've learned that Apaches rewrite-machinery is rather expensive (in CPU cycles) and my small patch to the VirtualHostMonster is comparably cheap.
Well, you can use two rewrite rules instead of one and use a cheaper way of comparing - something like RewriteCond %{HTTP_HOST} ^.*:80$ RewriteRule ..../http/%1/... [L] RewriteRule ..../htto/%1:80/... This may be somewhat cheaper than dieters solution. After that I'm not really sure that your python snippet is really cheaper than the rewrite rule. I'd guess it isn't. cheers, oliver