
|
View Full Version : How to make domain.com jump to www.domain.com?
kreativ 06-30-2002, 11:50 PM With Plesk, there is a "www" option which will automatically convert all http://domain.com/ requests to http://www.domain.com/
So http://domain.com/folder/page.html would auto-convert to http://www.domain.com/folder/page.html
How do I do this for sites not hosted on Plesk? Is Plesk doing this through a DNS record, or something else?
Global-Host2 06-30-2002, 11:51 PM add www record.
eddy2099 06-30-2002, 11:54 PM Well, Yup, you are right about the DNS record thing.
You will need an Cname entry to achieve that.
Here is the URL which contains more information :
http://www.rscott.org/dns/cname.html
Global-Host2 06-30-2002, 11:59 PM You could use an A record as well
Rochen 07-01-2002, 12:06 AM The record should look something like this:
www 14400 IN CNAME domain.com.
The TTL (14400) may vary. Also please note the trailing "." after domain.com. Obviously replace "domain.com" with the domain name :)
Techark 07-01-2002, 12:15 AM Huh?
If I am reading the question right you are wanting add an alias file so the web site can be called by www.domain.com or domain.com either one. If I am assuming correctly, all you have to do is add Serveralias www.domain.com domain.com to the VitrualHost directive for that domain.
Rochen 07-01-2002, 12:19 AM Monte - That's how I read it at first, however after reading it again, I didn't really see the point in making www go to non-www, since they are most likely going to be the same thing. So I thought kreativ was asking how to add www. Anyway, whatever the question may be I think it is covered in one of the posts here heh ;)
kreativ 07-01-2002, 12:19 AM I thought "www.domain.com IN CNAME domain.com" simply allows someone to type in www.domain.com without getting a server not found message. (i.e. it's just an alias for domain.com). How would this convert http://domain.com/page.html to http://www.domain.com/page.html?
kreativ 07-01-2002, 12:21 AM Oops, I probably wasn't very clear in my original post. I'm assuming the www CNAME is already present. Otherwise, no one could access the site through www.domain.com.
What I meant was, Plesk has an option in the control panel where if a visitor accesses the site by typing in "http://domain.com/page.html", the URL is automatically changed for them to "http://www.domain.com/page.html"
I'd like to know the most efficient way to do that on a non-Plesk site (Ensim, CPanel, etc.)
Am I making any sense?
elsmore1 07-01-2002, 12:26 AM Originally posted by kreativ
With Plesk, there is a "www" option which will automatically convert all http://domain.com/ requests to http://www.domain.com/
So http://domain.com/folder/page.html would auto-convert to http://www.domain.com/folder/page.html
How do I do this for sites not hosted on Plesk? Is Plesk doing this through a DNS record, or something else?
As has already been mentioned, you will need either a CNAME or an A record in the DNS for the www for it to resolve, this will not "auto convert" http://domain.com/folder/page.html to http://www.domain.com/folder/page.html though. To get that to happen (if you really need it), you are going to need to rewrite the URL, which , with the apache webserver is done using mod_rewrite. If you have mod_rewrite available in your apache server, you can put lines similar to the following in either the server config file, or in .htaccess files....
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain\.com [NC]
RewriteRule ^/(.*) "http://www.mydomain.com/$1" [L,R]
Of course, this needs to be in the appropriate part of the configuration file or file system so that it will be activated by requests to http://mydomain.com....
Techark 07-01-2002, 12:28 AM I guess I am still confused:cartman:
For instance you can address all the sites on my server http://domain.com or http://www.domain com it does not matter. Are you saying you want make it change in the address bar to www. domain.com if they type just domain.com? If so I have no idea and I am backing out of this post, before I make a fool of myself. :D
kreativ 07-01-2002, 12:33 AM Originally posted by Monte
I guess I am still confused:cartman:
For instance you can address all the sites on my server http://domain.com or http://www.domain com it does not matter. Are you saying you want make it change in the address bar to www. domain.com if they type just domain.com? If so I have no idea and I am backing out of this post, before I make a fool of myself. :D
Yes, that's what I was trying to get at in my porrly worded post. :) Thanks for the better wording.;)
|