Cloned Centos 6.4 websrver for test purpose. Virtual host, .htaccess, redirecting url issue

Posted by Shogoot on Server Fault See other posts from Server Fault or by Shogoot
Published on 2013-06-27T07:49:03Z Indexed on 2013/06/27 10:23 UTC
Read the original article Hit count: 180

Filed under:

I see similar questions, but not my exact challenge.

What I have done so far I cloned a prod server over to a vmware to use it as a test server for new functionality I'm going to write. I'm not a sysadmin by trade, but I'm new to this company and I have to do some thing that are outside of my comfort zone (thats a good thing :) )

The prod server has 2 sites on it s1.com and s2.com. In /html/s1/, /html/s2/ there's an .htaccess file under each s*/. Looking like this:

RewriteEngine ON
RewriteBase /
RewriteCond %{QUERY_STRING} id=([0-9]+)        
RewriteRule ^.*  %1.htm
RewriteCond %{QUERY_STRING} page=modules/checkout
RewriteRule ^.*  order.php
RewriteCond %{QUERY_STRING} page=pages/sidekart
RewriteRule ^.*  pages/sidekart.htm

The issue is that s1 has a lot of pages that really belongs under a third domain s3, the rule in line 4 and 5 redirects them to /html/s1/. An example of such URL is: s3.com/?page=modules/product&id=521614

I'm trying then to get those URLs (without modifying the URL) to redirect to s3's /html/s3/ server structure, which I set up making a new virtualhost s3 in test servers httpd.conf with a test3.com as servername and changing the other sites to tests1.com and tests2.com, and adding .htaccess also to this s3 root directory, and making a html/s3/ directory structure I populated with an index.html, etc.

But, when I take the same URL (s3.com/?page=modules/product&id=521614) changing it to tests3.com/?page=modules/product&id=521614, I get s1's index page showing up in my browser. I've poked around about a day now and i cant figure out why this happens.

© Server Fault or respective owner

Related posts about .htaccess