> Just seems like a strange way to write it:
>
>
>         if (not port 443)
>
>
> is not logically the same as:
>
>
>         if (port 80)

You make a good point.  The original will not work for ports other
than 80 even though it looks like it might, I think it would be better
to write the script like this:

RewriteCond %{HTTP_HOST}  !^www\.example\.com$ [NC]
RewriteCond %{HTTP_HOST}  !^$
RewriteCond %{SERVER_PORT}  ^80$
RewriteRule ^/(.*)$  http://www.example.com/$1 [R=301,L]

RewriteCond %{HTTP_HOST}  !^www\.example\.com$ [NC]
RewriteCond %{HTTP_HOST}  !^$
RewriteCond %{SERVER_PORT}  ^443$
RewriteRule ^/(.*)$  https://www.example.com/$1 [R=301,L]

RewriteCond %{HTTP_HOST}  !^www\.example\.com$ [NC]
RewriteCond %{HTTP_HOST}  !^$
RewriteCond %{SERVER_PORT}  !^443|80$
RewriteRule ^/(.*)$  http://www.example.com:%{SERVER_PORT}/$1 [R=301,L]

This way http://foo.example.com:8080/ -> http://www.example.com:8080/.

Regards,
John
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to