Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stopping false sub domains

Status
Not open for further replies.

vodkadrinker

Technical User
May 16, 2002
163
GB
Currently xxx.mydomain.com goes to the primary domain mydomain.com page.

How do I stop this so that if someone enters a subdomain that doesn't exist it doesn't go anyware?
 
This is not default behavior for apache so you may be allowing this to happen. Check the ServerName directive in httpd.conf and see if it uses a wildcard in either the ServerName or ServerAlias. There is also an outside chance that your domain's dns is setup to use a wildcard CNAME. That too should be easy to check.



 
I think I need to clarify apache's default behavior. If dns is pointing a request for a subdomain to your ip address, apache will try to resolve it. If it doesn't find a match, it will serve the default vhost which is the first one defined in httpd.conf. You can change this by having apache display an error page. This page can be anything you want. Sorry for the confusion but my coffee hasn't kicked in yet.

 
You might be using wildcard A record in DNS (not my favorite) that points ALL forward requests to your DNS server. If so, then the easiest way is use RewriteCond to 404 all host names that don't match your webserver.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top