Redirect domain’s content to another domain
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.
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>
Check more discussion of this question.
Related posts:
- How can I have an Apache server at a single IP which serves different content to requests for different domain names?
- SPF include vs redirect
- VirtualHost not directing properly based on domain name
- Redirect ALL Traffic to single page if a domain matches
- Merge two different domains but save virtualhost with Apache redirect
Leave a comment
Recent Posts
Tags
active-directory
amazon-ec2
apache
apache2
backup
bash
centos
cisco
command-line
debian
dns
email
exchange
firewall
iis
iis7
iptables
linux
macosx
monitoring
mysql
networking
nginx
performance
permissions
php
postfix
raid
security
sql-server
sql-server-2005
sql-server-2008
ssh
ssl
ubuntu
unix
virtualization
vpn
webserver
windows
windows-7
windows-server-2003
windows-server-2008
windows-server-2008-r2
windows-xp





