note 80374 deleted from ref.session by danbrown
| From: | danbrown@php.net | Date: | Sun, 20 Jul 2008 16:33:52 +0000 |
| Subject: | note 80374 deleted from ref.session by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142183@lists.php.net to get a copy of this message | ||
Note Submitter: ajmconsulting_dot_net
----
Another way of handling the "www" versus non-"www" URL's:
In your .htaccess file, add:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.yourdomain.com$
RewriteRule ^(.*)$ http://yourdomain.com/$1 [R=301,L]
This will rewrite:
www.yourdomain.com/anything
to:
yourdomain.com/anything
To reverse, e.g. add a www if it isn't present, change the 3rd line to:
RewriteCond %{HTTP_HOST} !^www.yourdomain.com$