How to use mod_rewrite to redirect a URL

I'm trying to find the best way of accomplishing the following:

I have 2 separate web servers, let's call them and

The server hosting is being decommissioned, but there are still active links pointing to it that my customers may continue to use.

Some of the customer links point directly to a perl script with embedded variables, something like this:

Once I point the domain to the server hosting, I'd like the above URL to be redirected to:

It makes no difference to me whether the end users sees the change in domain name, but I don't want them to get an SSL warning or error.

Is the best way to handle this to use a rewrite rule, an alias, or some other method? Please be as specific as possible with rewrite rules -- my skills are beginner in using mod_rewrite.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Copy everything to the new server - i.e. the old domain
Update the DNS
When the DNS has propogated (upto 48 hours) you can disable the old server and initiate an htaccess on the new server to redirect the old domain to the new domain

But if the old sites ssl cert is expiring then it won't work once it has expired, so you would need to ensure you update it while there may still be links out there.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
datastarstarAuthor Commented:
The SSL cert on the old server is still valid -- can I just move that to the new server or does it have to be reissued? And is it possible to have certificates for both domain names in the same crt file?
You can just move everything.

And is it possible to have certificates for both domain names in the same crt file?
No, each cert needs to be seperate
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

datastarstarAuthor Commented:
Ok, I'm a little confused about this part. I will have no need to segregate the two sites on the new server. I was planning to just point the old domain ( to the same IP of the server hosting  Can I use a ServerAlias in my apache config in the same virtualhost for How then would I specify the location of separate SSL certificate files?

I'm thinking my virtualhost directive would look something like this:
    SSLEngine on
    SSLCertificateFile       /etc/httpd/conf/ssl/abc.crt
    SSLCertificateKeyFile    /etc/httpd/conf/ssl/ssl.key
Ok you can point both domains to the same document root, then in your htaccess setup the redirect condition based on the old domain name
But you can't have one cert for two different domains which is where you are stuck since you are using SSL for the site.
datastarstarAuthor Commented:
What if I pointed xyz to a different IP on the new box and and had a virtualhost section for xyz that used the same document root as abc but pointed to a different ssl certificate? Would that work?
That's what I was saying above.
datastarstarAuthor Commented:
Got it -- thanks for your help!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.