homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

users entering www

 10:25 am on Aug 2, 2014 (gmt 0)


I have a client on my server which is running unbuntu.

The problem is that when a user enters wwww before a url they are shown the homepage of the first domain in the domains folder, for example if I have many domains in the domains folder on the server with the top domain being 123.com.

When a user enters wwww.xyz.com they are actually served with the homepage of 123.com, which isn't good but we have also discovered it meses up the se spider as well and there is all kinds of weird indexing going on.

Has anyone else come across this?

Anyway I am trying to figure out a fix for this so that when someone enters wwww or ww or w before xyz.com they are directed to www.123.com.

I have tried setting A records for each prefix but that didn't work and I am not having much luck with .htaccess either.

Any words of wisdom or examples would be greatly appreciated





 10:43 am on Aug 2, 2014 (gmt 0)

I had that once on my web server, it was in fact the virtual hosts were not declared properly I added * in the DNS declaration (*.mysite.com)
when i typed in mysite.com instead of www.mysite.com it brought me to the first site on the server (alphabetically)
Is this your case
For the rest I am not clear on what set up you have and some parts I do not understand.


 11:19 am on Aug 2, 2014 (gmt 0)

Hi pp46,

yes I already have * A record for the domains and tried to set a records for wwww,ww and just w but that didn't work as the probeml was still there.

I think it might be some sort of server misconfig but am waiting for a reply from tech support.

Anyway thanks for your quick input it's much appreciated




 1:24 pm on Aug 2, 2014 (gmt 0)

I think there are two problems..

1) The first virtual host is the default virtual host in apache. So if a hostname can not be mapped to a virtual host the first virtual host is used. Thats why i configure an empty first virtual host. I think if you type the IP of the server in your browser 123.com is displayed?

2) If every hostname like <whatever>.xyz.com returns an IP address there is a problem in the DNS of xyz.com. Remove * record. And wait till you get a fresh DNS answer NOT the cache.


 1:51 pm on Aug 2, 2014 (gmt 0)

Hi bhukkel,

thanks for your reply, I think we have it sussed now, basically we have set up a dummy virtual server and "badurl.com" and then tied that to the to the servers Ip address, so now when we get someone using wwww,ww or w they see a page informing them that have entered a bad url, please check it and try again and it is working phew!

Thanks again



 6:35 pm on Aug 2, 2014 (gmt 0)

welcome to WebmasterWorld, Dave!

you should read the Apache documentation on configuring name-based virtual hosts:


 8:18 pm on Aug 2, 2014 (gmt 0)

Hi ozbod,

That sounds like a good solution, but it asks the visitor to do some work in order to get to the right domain. For more immediate solutions, have you tried Apache's mod_alias to setup simple redirects from w., ww. or wwww.?

Docs are here: [httpd.apache.org...]


 9:55 pm on Aug 2, 2014 (gmt 0)

Hi phranque and n0tSEO, thank you both for your input, looks like I need to do some learning so thank you for the references, I will look into them and discuss them with the server Sys Admin.

Have a good day Guys




 8:52 pm on Aug 3, 2014 (gmt 0)

A warning: If you permit several subdomains (eg w, ww, www) then make sure they are 301'd to a single home site, otherwise search engines WILL gather them all and accuse you of spamming.


 8:35 am on Aug 4, 2014 (gmt 0)

have you tried Apache's mod_alias to setup simple redirects from w., ww. or wwww.?

mod_alias will not allow you to examine the requested hostname, so you want to use mod_rewrite for this instead.


 6:28 am on Aug 15, 2014 (gmt 0)

Hi All,

just wanted to let you now that we got to the bottom of this problem in the end, it was in the DNS settings, we deleted the * A record and all is good now, for example if we use wwww we now get a page not found page which is what it should be, yes the visitor is left at a bad page but the spiders can't go anywhere from here.

Thanks for your input everyone


Global Options:
 top home search open messages active posts  

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved