We've recently created a new "main website" that consolidates two older sites, and need to do some final DNS and Apache configuration work for each of the old ones. (To clarify for some, this is a small company without the resources to hire experts, and I'm trying to assist in an area that is not my specialty, and determine how these changes need to be made.)
We want to point the old sites to a folder on the new site that will "translate" the requests, as well as a couple of old subdomains pointing to new subfolders within the "translation" folders.
I've looked at related questions, but they all include considerations that are way out of my league, and are on shared hosts. Our sites are both located on EC2, so we have full control/responsibility of what gets changed.
The confusing part is a single IP being used for mulitple domains, and all of them having the same subdomains. I'm baffled as to how to insure that the primary domains are work correctly, and that the subdomains for each are still intact after everything is complete.
http://www.newsite.com ==> c:\www\index.php
http://subX.newsite.com ==> c:\www\subdomainX\index.php
http://www.oldsite.com ==> c:\www\oldsite\index.php
http://subX.oldsite.com ==> c:\www\oldsite\subdomainX\index.php
http://www.newsite.com ==> www.newsite.com/
http://subX.newsite.com ==> www.newsite.com/subdomainX/
http://www.oldsite.com ==> www.newsite.com/oldsite/
http://subX.oldsite.com ==> www.newsite.com/oldsite/subdomainX/
Oldsite http.conf (that is being shut down)
<VirtualHost *:80>
ServerName oldsite.com
DocumentRoot "c:/apache/htdocs/hosted/oldsite"
ServerAlias *.oldsite.com 10.20.30.40
RewriteEngine On
RewriteOptions Inherit
</VirtualHost>
<VirtualHost *:80>
ServerName subX.oldsite.com
DocumentRoot "c:/apache/htdocs/hosted/oldsite/subX"
RewriteEngine On
RewriteOptions Inherit
</VirtualHost>
NEW http.conf (That is currently working in production)
<VirtualHost *:80>
ServerName subX.newsite.com
DocumentRoot "C:/www/subX"
RewriteEngine Off
</VirtualHost>
What I'm trying to accomplish:, but seeking guidance/clarity on correctness:
For http://www.oldsite.com ==> c:\www\oldsite\index.php
<VirtualHost *:80>
???????????
ServerName oldsite.com
DocumentRoot "c:/www/oldsite"
</VirtualHost>
For http://subX.oldsite.com ==> c:\www\oldsite\subdomainX\index.php
<VirtualHost *:80>
???????????
ServerName subX.oldsite.com
DocumentRoot "c:/www/oldsite/subX"
</VirtualHost>
I think the DNS changes are no different, other than the new IP address, but I have no idea how to approach the Apache setup to accomodate the shared subdomains.
Update
We're retiring the old domain, so when someone goes to www.oldsite.com or sub1.oldsite.com, we want a permanent redirect to the appropriate folder in www.newsite.com. From there, the index.php contained within the folder will do the work. A url like www.oldsite.com/somewhere will be handled by www.newsite.com/oldsite/index.php.
Can someone guide me through this? I'm trying to figure out WHAT to setup to test, and as soon as I click "save", all hell is going to break loose if it's not correct. My DNS/Apache skills are iffy at best, and this is a production environment, so I can't afford to risk the down time of my typical learning curve, lol.