0

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)
5
  • Show the output of httpd -S
    – user9517
    Nov 14, 2015 at 12:43
  • @lain updated the post with output of httpd -S
    – mishka
    Nov 14, 2015 at 13:38
  • Maybe try ReWrite rules - stackoverflow.com/questions/21118511/… Nov 14, 2015 at 14:32
  • just add document root (with any existing folder like /var/www/) in both
    – Froggiz
    Nov 14, 2015 at 14:34
  • Looks like RewriteRule is the way to go.
    – mishka
    Nov 15, 2015 at 5:11

0

You must log in to answer this question.

Browse other questions tagged .