Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Several of my clients created an "A" record to point a sub domain of their site to my server. E.g., http://subdomain.clientsite.com points to my IP address.

This works fine. However, if I manually insert a prefix such as "www" to make the URL look like "http://www.subdomain.clientsite.com" it resolves to my website instead of the client's site. I can add anything besides "www" as a prefix.

What is the best way to disable a "sub-subdomain"? It seems like it would be possible to do via the vHost file for each client or perhaps through an .htacess command. However, I don't know the best way to proceed.

Thanks for your thoughts.

share|improve this question

2 Answers 2

Not sure why this problem occurs, though it is only for certain clients so it could depend on how a web host handles "A" records.

In any event, I added the following line to a vHost file for one of my clients:

ServerAlias subdomain.clientsite.tld *.subdomain.clientsite.tld

and it seemed to do the trick. Got the idea from this link: http://www-01.ibm.com/software/webservers/httpservers/doc/v1326/manual/vhosts/name-based.html

share|improve this answer

I can see how a client might have an A record of the form:

subdomain.example.com. 251 IN A 10.9.8.7

I don't see why www.subdomain.example.com automatically resolves to the same IP, unless you have a CNAME for each subdomain. But then you say that anything.subdomain.example.com behaves this way, so I don't understand what you have set up.

It is not uncommon to use a rewrite rule to redirect www.something.com to something.com - for example in Apache, you would do something like this:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.something.com$ [NC]
RewriteRule ^(.*)$ http://something.com/$1 [R=301,L]

This will have the effect of sending traffic from www.something.com to something.com, which is quite often done in the interests of search engine optimization.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.