Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose I have a portal which has subdomains like, and suppose a user, say user1 has a domain -

Can user1 create a subdomain - which will point to the existing

I know I can redirect it but that's not what I am looking for.

Explaining my problem a bit more.

i have a rails app running on apache and passenger, on a machine with ip say, to which is pointed to.

suppose i am creating a new subdomain called which will serve a couple of static pages from the same rails app, can i do something so that the requests to is served from this same app ?

share|improve this question

You can point it at that address or use CNAME records (or DNAME, but they don't behave like you would normally want them to). Domains can point wherever; something being a subdomain really has no bearing except on where you look to resolve it.

share|improve this answer
Thank you falcon, i have edited my question to explain a bit more about my problem. – Krishnaprasad Varma May 7 '12 at 4:11

Yes, you can. A domain can be pointed to any IP address, regardless of what else may be pointing to the same address.

share|improve this answer

If you want to do this with least effort, then you just need to match on 'user1' (the string common to both domains). But you need to plan for how to deal with users called 'www' and 'com'.


RewriteEngine On
RewriteCond %{HTTP_HOST} \.user1\..
RewriteRule ^/(.*)$  /home/user1/www/$1 [L]

And set the virtualhost as '*:80'

share|improve this answer
thank you for this snippet . hope it helps one or the other way – Krishnaprasad Varma May 7 '12 at 4:24

I think you have two issues here:

1) Point the to the same ip of or with a CNAME

2) Setup a VirtualHost in Apache to server the same rails app for the two domains names. Just like this:

ServerName ServerAlias

share|improve this answer

Your Answer


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.