NYCPHP Meetup

NYPHP.org

[nycphp-talk] Canonical hostname help

Rick Retzko rick at click-rick.net
Thu Dec 6 10:07:24 EST 2007


Hi - I don't have an answer on this, but a good article on mod Rewrite was
in the latest issue of PHP|architect.  Advise if you need a copy.
 
Best Regards - 
 
Rick
============
rick at click-rick.net
 
 

  _____  

From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On
Behalf Of Cliff Hirsch
Sent: Wednesday, December 05, 2007 1:59 PM
To: NYPHP Talk
Subject: [nycphp-talk] Canonical hostname help


If I want to redirect domain.com to www.domain.com (or for that matter
anything.domain.com to www.domain.com I have figured out (but not tested)
the following so far:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L, R=301]
</IfModule> 

But what about https? How can I make the redirect work for both http and
https transactions, redirecting http to http and https to https?

Cliff 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20071206/c89fd7d1/attachment.html>


More information about the talk mailing list