Help - Search - Members - Calendar
Full Version: www? Probably a dumb question...
The Planet Forums > Control Panels > Plesk
Helter
What's the difference between entering a clients domain with or without the WWW thing checked?
meballard
I'm guessing, but it's probably the difference from being able to use:
www.domain.com
to access a site in addition to:
domain.com
Helter
That's what I thought, but wanted to find out if someone new for sure....

I don't think that I've ever had a domain where www.domain.com wasn't the same as domain.com.
Rich2k
No but some sites don't use www. (example try going to www.dmoz.org and you get dmoz.org)
bobk
If you check the "www" box, Plesk sets up the server as www.example.com. It also adds an Apache config entry so that all trafic to example.com gets redirected to www.example.com.

My problem with this is is that it now appears in the browser address bar as www.example.com, and I decided that if it was going to rewrite the URL, I prefer to have it rewrite the "www" to the version without the hostname, in other words, do it the other way around.

So, I set up my domain without checking the "www" box. Then I added this to the end of httpd.conf:


ServerName www.example.com
RedirectPermanent / http://example.com/


Where ip.ip.ip.ip is your server IP address.

Now, everything redirects to the bare domain name. Basically, the reverse of the way Plesk does it.

Ideally, I'd prefer to have it work without rewriting the URL, but I haven't had much luch using the ServerAlias directive, which is supposed to accomplish this.
bobk
Well, that got me curious enough to try and figure out the ServerAlias directive in Plesk. Turn out it's fairly easy.

Create a file:

/usr/local/psa/home/vhosts/example.com/conf/vhost.conf

That file needs only to have one line:

ServerAlias *.example.com

It doesn't need the container.

Just restart Apache, and it will answer to *.example.com without rewriting the header. Of course, you can be more specific if you want, eg:

ServerAlias www.example.com

If you're running SSL, also create a similar file named vhost_ssl.conf. (I haven't tried this yet, just read about it elsewhere). With SSL, you'll get browser errors if the requested URL doesn't match the certificate, so you probably want to use an explicit entry instead of a wildcard for SSL.

It would probably be easy to create a script that added these entries for each domain.
Rich2k
It's actually the other way around.

If you look at the DNS then example .com is an A record and www.example.com is a CNAME of example.com


e.g.

CODE
example.com    86383 IN    A    IP.IP.IP.IP

[url]www.example.com    86400[/url] IN    CNAME    example.com


Of course you can change your default Plesk DNS configuration anyway.
micxz
"The page cannot be displayed"

Why would this happen if I was trying the "www" check box. Does DNS have to propogat for this to work?

My problem one domain that's been working fine for months simply started not resolving after I played with the check box' without it domain.com resolves and NOT with the www's. With it checked www.domain nor domain.com work. I'm stuck? Please HELP!

Weird'
Gentle Giant
Hi micxz,

This should have nothing to do with propogation - assuming that you have both...

domain.com IN A 111.111.111.111
www.domain.com IN A 111.111.111.111


In otherwords as long as they both exist in your zone file, it will 'exist' - if the DNS is correct, then it is a problem on the server.

Why plesk uses CNAMES I do not know - it is better simply to have all the various options of www. / ftp. / webmail. /smtp. etc, as A records.

Maybe there is a reason for this, that I am unaware of - and would welcome input.
micxz
I might have found a small bug in plesk'

When you add a cname for www, plesk automatically checks the www box for you. I'm on 2.2.5.

And no Now I have it "bobk" way the opposite of plesk'

Micxz
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.