Note: My question is similar to one here but I'm trying to achieve something slightly different.
A. I would like to create two vhosts
on a ec2
instance that has a elastic ip attached.
B. Each of these two vhost
definitions redirect a domain to different url on a different site.
i.e
www.site01.com should redirect fully to http://www.socialsite.com/profile01
www.site02.com should redirect to a category page on a ecommerce site http://www.sellitall.com/cat/0285
C. These are full redirects i.e query strings should be discarded and irrespective of the URL/URI user should be redirected to the given page.
Here is what I tried and unfortunately, only first redirect works and both site01
and site02.com
are now redirected to http://www.socialsite.com/profile01
. Further, query strings are messing up the redirects resulting in page not found errors.
<VirtualHost 10.0.0.140:*>
ServerName www.site01.com
Redirect 301 / http://www.socialsite.com/profile01
</VirtualHost>
<VirtualHost 10.0.0.140:*>
ServerName www.site02.com
Redirect 301 / http://www.sellitall.com/cat/0285
</VirtualHost>
Output of httpd -S
:
VirtualHost configuration:
10.0.0.140:* www.site01.com (/etc/httpd/conf/httpd.conf:451)
10.0.0.140:* www.site02.com (/etc/httpd/conf/httpd.conf:441)