Forum: Ruby on Rails Moving from one dns domain to another

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D3fc5887a2f39f2e0c8989d39ce5e6f9?d=identicon&s=25 Bharat Ruparel (bruparel)
on 2008-10-07 15:35
My Rails 2.1 app is changing DNS domains.  For example:
From: www.oldcompany.com
To:   www.newcompany.com
The app uses Apache2, mongrel_cluster, MySQL.
I would like the existing users who visit www.oldcompany.com URLs to be:
1.  Notified via an HTML page that the site has changed from oldcompany
to new company and then redirect them to newcompany.
This has to be done on the same server which gets new host name etc.

I know that it can be done with mod_rewrite, but I am not proficient
with it.  Is there a rewrite rule that I can put into my httpd.conf file
that will detect the incoming URLs with oldcompany hostnames and
redirect them to a particular HTML page?
For some time, I can keep both the new and old DNS names pointed to the
same IP address.
Thanks.
Bharat
00973881979aa0a660ffbbb2f7a907fb?d=identicon&s=25 Peter De Berdt (Guest)
on 2008-10-07 15:59
(Received via mailing list)
On 07 Oct 2008, at 15:35, Bharat Ruparel wrote:

>
> I know that it can be done with mod_rewrite, but I am not proficient
> with it.  Is there a rewrite rule that I can put into my httpd.conf
> file
> that will detect the incoming URLs with oldcompany hostnames and
> redirect them to a particular HTML page?
> For some time, I can keep both the new and old DNS names pointed to
> the
> same IP address.


 From http://www.addedbytes.com/apache/url-rewriting-for...

To redirect an old domain to a new domain:

RewriteCond %{HTTP_HOST} old_domain\.com [NC]
RewriteRule ^(.*)$ http://www.new_domain.com/$1 [L,R=301]


Best regards

Peter De Berdt
D3fc5887a2f39f2e0c8989d39ce5e6f9?d=identicon&s=25 Bharat Ruparel (bruparel)
on 2008-10-07 16:53
As always, thanks Peter.
Regards,
Bharat
4c438a80fc30661ad619ea177cf9cbd0?d=identicon&s=25 Freddy Andersen (Guest)
on 2008-10-07 18:49
(Received via mailing list)
Hi,

If you want the customer to land on a landing page that redirects
after 5/10 seconds you should just setup two virtualhosts in apache
one for the new domain and one for the old...

The old domain has one index.html file inside the doc root which has a
META refresh inside. example:

<html>
  <head>
    <title>New Site Name</title>
    <META http-equiv="refresh" content="5;URL=http://
www.newsite.com">
  </head>
  <body bgcolor="#ffffff">
    <center>
    The contents you are looking for have moved. You will be
redirected to the new location automatically in 5 seconds. Please
    bookmark the correct page at <a href="http://
www.newsite.com">www.newsite.com</a>
    </center>
  </body>
</html>

That will give a landing page for the old site that redirects to the
new site after 5 seconds...
D3fc5887a2f39f2e0c8989d39ce5e6f9?d=identicon&s=25 Bharat Ruparel (bruparel)
on 2008-10-08 01:23
Thanks Freddy,
This was very helpful too.
Regards,
Bharat
This topic is locked and can not be replied to.