Page 1 of 1

Forcing www in the URL with wildcard subdomains

Posted: Wed Dec 06, 2006 9:05 pm
by Nathaniel
Hi guys,

I have wildcard subdomains enabled, and this code in my .htaccess file to force the www to be in the url isn't working.

Code: Select all

php_flag zlib.output_compression On
php_value zlib.output_compression_level 5

RewriteEngine On
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} ^habitformer\.com [NC]
RewriteRule (.*) http://www.habitformer.com/$1 [R=301,L]
Any ideas? The exact same code with the domain changed works fine on another domain that doesn't have wildcard subdomains enabled.

Posted: Fri Dec 08, 2006 12:12 pm
by RobertGonzalez
Is mod_rewrite working at all?

Posted: Fri Dec 08, 2006 5:30 pm
by Nathaniel
Oh yes, my content is being gzipped just swell. (See the first two lines of the code I posted.)

I think I'm going to use auto_prepend_file and have PHP take care of the deal.