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.

I have a server running ubuntu, with a domain bc.com's A record point to it.

I want to setup aa.bc.com, cc.bc.com to redirect to bc.com/b.jsp?id=aa/cc

What I should install to make that work?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Subdomains are done through DNS, however, the manipulation you are talking about will involve both DNS trickery and configuration of your web server. You will need to point subdomain.example.com to example.com as a CNAME record as a first step. Once that is complete, you will need to create rewrite rules using mod_rewrite (if you are using Apache) to forward the subdomain to the argument to the jsp file.

share|improve this answer

Create CNAME or A record:

aa.bc.com.        CNAME  bc.com.
cc.bc.com.        CNAME  bc.com.

Configure Apache 2(mod_rewrite):

RewriteCond %{HTTP_HOST}   ^aa\.bc\.com$ [NC]
RewriteRule ^/(.*)         http://bc.com/b.jsp?id=aa [L,R]

RewriteCond %{HTTP_HOST}   ^cc\.bc\.com$ [NC]
RewriteRule ^/(.*)         http://bc.com/b.jsp?id=cc [L,R]
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.