NYCPHP Meetup

NYPHP.org

[nycphp-talk] Canonical hostname help

Cliff Hirsch cliff at pinestream.com
Wed Dec 5 17:35:23 EST 2007


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





More information about the talk mailing list