no www in domain ?? how to enable / turn on ??

hi, im running virtualmin under Debian etch which has been great its just now cant figure out why the servers ive created are just listing as http://domain.com rather than with the www.

is there an option somewhere or some way to tell it to make www the default ??

regards,

Hayden.

Howdy,

When you say that they’re “listing as domain.com”, where is that listing you’re looking at?

Virtualmin sets up the domain name "domain.com" whenever it creates the Virtual Server, but it also (by default, anyhow) sets up "www.domain.com" as an alias.

Both would be valid ways of accessing the site.

Where is it that isn’t working as you’d hope?
-Eric

the domain is http://thehelmetwarehouse.com.au

when and i know about the alias for http://www.thehelmetwarehouse.com.au

but i want it so its always www, rather than without

sorta but not that simple, as whenever i go to

http://www.thehelmetwarehouse.com.au/store.php

it writes all the links in the page without the www. ???

ie

<a href="http://thehelmetwareho

bear in mind there is temporary htaccess rewite till i can fix it so going to www. at the moment writes out the www, but this is temp and just for continuity.

Heh, well that does explain a few things :slight_smile:

Okay, the links being written are done so by the PHP generating the page there.

I’m not sure if your site is using a CMS of some sort, or if that’s custom PHP.

If it’s a CMS, you may need to update the URL it thinks it’s running on to include the ‘www’. That would be in the Settings/Preferences somewhere (though where exactly depends on what CMS it is).

If that’s a custom app you created, then there’s likely PHP code or a template somewhere containing that URL rather than the ‘www’ you’re interested in.
-Eric

Hrm, is a redirect what you’re after?

So whenever someone goes to:

http://thehelmetwarehouse.com.au

It then redirects to the www address:

http://www.thehelmetwarehouse.com.au

You can add a redirect by adding the following code to either a .htaccess file in the public_html folder for the above domain, or in the Apache’s VirtualHost section for the domain:

[code:1]
RewriteEngine on
RewriteCond %{HTTP_HOST} ^thehelmetwarehouse.com.au
RewriteRule ^(.*)$ http://www.thehelmetwarehouse/$1 [R=permanent,L]
[/code:1]

bear in mind there is temporary htaccess rewite till i can fix it so going to www. at the moment writes out the www, but this is temp and just for continuity.

RewriteEngine on
RewriteCond %{HTTP_HOST} !^(thehelmetwarehouse.com.au)$
RewriteRule (.*) http://thehelmetwarehouse.com.au [R=301,L]

bear in mind there is temporary htaccess rewite till i can fix it so going to www. at the moment writes out the www, but this is temp and just for continuity.

RewriteEngine on
RewriteCond %{HTTP_HOST} !^(thehelmetwarehouse.com.au)$
RewriteRule (.*) http://thehelmetwarehouse.com.au [R=301,L]