Forcing www in the URL with wildcard subdomains

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
Nathaniel
Forum Contributor
Posts: 396
Joined: Wed Aug 31, 2005 5:58 pm
Location: Arkansas, USA

Forcing www in the URL with wildcard subdomains

Post 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.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Is mod_rewrite working at all?
User avatar
Nathaniel
Forum Contributor
Posts: 396
Joined: Wed Aug 31, 2005 5:58 pm
Location: Arkansas, USA

Post 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.
Post Reply