Revision: 18764
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 7, 2009 20:22 by traeregan
Initial Code
if ((strpos($_SERVER['HTTP_HOST'],'www.')===false)) { header('Location: http://www.yourdomain.com'); exit(); }
Initial URL
http://www.bradino.com/php/force-www-subdomain/
Initial Description
Sometimes you do not want users to access your domain without the www. If you want to force www.yourdomain.com and redirect yourdomain.com to www.yourdomain.com here is a simple way to do it.
Initial Title
Force WWW Subdomain
Initial Tags
Initial Language
PHP