NYCPHP Meetup

NYPHP.org

[nycphp-talk] Canonical hostname help

Ajai Khattri ajai at bitblit.net
Wed Dec 5 18:19:48 EST 2007


On Wed, 5 Dec 2007, Cliff Hirsch wrote:

> On 12/5/07 5:26 PM, "Ajai Khattri" <ajai at bitblit.net> wrote:
> 
> > On Wed, 5 Dec 2007, John Campbell wrote:
> > 
> >> This should work:
> >> 
> >> RewriteEngine on
> >> 
> >> RewriteCond %{HTTP_HOST}  !^www\.example\.com [NC]
> >> RewriteCond %{HTTP_HOST}  !^$
> >> RewriteCond %{SERVER_PORT}  !^443$
> >> 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]
> > 
> > 
> > Shouldn't the first rule use port 80 instead of 443?
> 
> There's a ! on the 443, so it should work. Otherwise ^80


Just seems like a strange way to write it:


	if (not port 443)


is not logically the same as:


	if (port 80)



-- 
Aj.




More information about the talk mailing list