NYCPHP Meetup

NYPHP.org

[nycphp-talk] Canonical hostname help

Cliff Hirsch cliff at pinestream.com
Wed Dec 5 14:44:43 EST 2007


On 12/5/07 2:28 PM, "John Campbell" <jcampbell1 at gmail.com> 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]
> 
Thanks John! That should do the trick.





More information about the talk mailing list