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

1) How would I redirect user1.domain.com to display domain.com/user?id=1 content?

2) How would I redirect domain1.com to display sub.domain2.com's content?

I have both domains on the same server/host, so I don't think changing A records in the DNS is the issue.

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

The following assumes that you are using Apache.

1) How would I redirect user1.domain.com to display domain.com/user?id=1 content?

Something like the following should work although I haven't tested it:

RewriteEngine On
RewriteCond %{HTTP_HOST}  ^user1\.domain\.com [NC]
RewriteRule . http://domain.com/user?id=1 [L,R]

2) How would I redirect domain1.com to display sub.domain2.com's content?

<VirtualHost *:80>
  ServerName domain1.com
  Redirect 302 / http://sub.domain2.com/
</VirtualHost>
share|improve this answer
    
Ah, thanks! One more minor question.. how would I make it so –  Kris Sauquillo Oct 7 '10 at 23:58
    
You could add those statements to either .htaccess or your apache configuration, depending whether you have root access or not. –  KayakJim Oct 8 '10 at 13:14
add comment

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.