Link to home
Start Free TrialLog in
Avatar of jcw20
jcw20Flag for United States of America

asked on

apache server with non www vs.www problem

ok   i have website  but when some types  http://www.jdcamp.org   vs.   http://jdcamp.org   one wikk work but the other will not  Help how do i fix this
Avatar of giltjr
giltjr
Flag of United States of America image

O.K.  Looks like you are using Apache and you have www.jdcamp.org setup as a virtual server, but you do not have jdcamp.org setup as a virtrual server so it is getting the default Apache web page.

You need to setup jdcamp.org up as a virtual server also.
ASKER CERTIFIED SOLUTION
Avatar of ravenpl
ravenpl
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
jcw20 - I had answered this in your original question.  

You can use a ServerAlias as mentioned, or you can set up a second virtual server entry for the www.jdcamp.org version.

I should mention that while ServerAlias is the built in function in Apache to do this, search engines often penalize you for having multiple domains or subdomains pointing to the same site, because of the abuse of this concept.  Same goes for having mulitple domains subdomains that simply point to the same site.

Therefore, for search engine optimization purposes, it makes more sense to set up a second entry, and do a permanent redirect like this:

<VirtualHost xxx.xxx.xxx.xxx:80>
    ServerName www.jdcamp.org
    (... )
</VirtualHost>

<VirtualHost site.com:80>
    ServerName jdcamp.org
    Redirect Permanent / http://www.jdcamp.org
</VirtualHost>


periwinkle: it has one drawback, what if somebody would want visit
http://jdcamp.org/subpage/
Ravenpl - good catch - I forgot the trailing slash.  It should be:

<VirtualHost site.com:80>
    ServerName jdcamp.org
    Redirect Permanent / http://www.jdcamp.org/
</VirtualHost>

(works on my server).