• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • Last Modified:

How do I solve the http:// verse www. problem for virtual hosts?

I have a virtual host that uses domainname.com. Problem is that only www.domainname.com works, but not http://domainname.com doesn't work. I tried scriptalias *.domainname.com, but that didn't work. Heres how my config file looks like:

NameVirtualHost *:80

<VirtualHost *:80>
   ServerName domainname.com
   ServerAlias *.domainname.com
   DocumentRoot /my/www

How do I solve this? Pls help. Thanks in advance for all the help.
1 Solution
> but not http://domainname.com doesn't work.

Does domainname.com resolve to your server (DNS,> name server entry)?

ServerName domainname.com should match taht request, your ServerAlias should match www.domainname.com 
I agree with caterham_www - there are two things that must resolve properly in order for a web site to come up as both www.domain.com and domain.com:

(1) dns for www.domain.com and domain.com has to resolve to the server
(2) the web site configuration file has to accomodate both www.domain.com and domain.com

You have (2), is it possibly set up differently for (1)?

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now