1

I need to change my domain's DNS, but here in Thailand the ISPs don't follow any standards for renewing their cache of records, so it can take the full two days.

I have a new website with about 1,000 members currently who are sending messages and uploading photos. I don't want both sites on the old and new server running at the same time because then I'd have to manually merge the database and transfer uploaded photos. It would be a huge pain.

Both servers also a unique URL from my host, e.g. website12345.hostingcompany.com (old host) and website67890.hostingcompany.com (new host).

I don't have much experience with this, but I think what I can do is on www.mysite.com, use .htaccess to do a masked redirect to the new server's URL (website67890.hostingcompany.com). Is it possible to do this and keep all URLs being masked? For example, www.mysite.com/profile/username will actually be loading website12345.hostingcompany.com/profile/username. From Google searches it sounds like this is possible, but I don't understand why this is possible due to security issues, since what's keeping people from masking their site to URLs like facebook.com?

I could really use some advice here! Thanks!

4
  • I read your question and I am confused about your use of one word. Could you clarify what you mean by masked redirect? I suspect the answer for you is fairly simple. But switching servers rarely comes with out some cost.
    – closetnoc
    May 30, 2014 at 15:54
  • What I mean is using .htaccess to have www.mysite.com redirect to website67890.hostingcompany.com, but still say www.mysite.com in the browser's address bar. But I also need subfolders to remain intact as well, e.g. www.mysite.com/search will redirect to website67890.hostingcompany.com/search, but keep www.mysite.com/search in the address bar. Sorry if my terminology isn't correct :)
    – Gavin
    May 30, 2014 at 17:48
  • I guess what was confusing me is GoDaddy offers domain name forwarding with masking (support.godaddy.com/help/article/422/…). I think with .htaccess you can only redirect with masking to different folders on the same domain, unless both domains are on the same server. These two sites are not on the same server, so I guess this option will not work. Although I'm just reading GoDaddy does allow subdomain forwarding with masking, so I need to look into this more.
    – Gavin
    May 30, 2014 at 18:03
  • @Gavin: Isn't the "forwarding with masking" feature offered by GoDaddy a form of framed forwarding? I think you might be able to do what you mention with mod_proxy (?), however, I think this requires lower level control of your server (not sure what kind of hosting you have?) and isn't just a case of a bunch of directives in .htaccess?
    – MrWhite
    May 30, 2014 at 19:47

1 Answer 1

2

DNS takes time to propagate. You can lower the TTL, but even then you will have some users that try to get to the old server for a short amount of time. If the TTL isn't being honored at a low value, I don't know of anything you can do about that.

The typical way of not having to merge databases between two sites is to create "read only mode" for the old site. In this mode, users will be able to view the site, but won't be able to upload or change data. StackExchange has such a mode and I've seen them use recently when the data center in NYC had problems and they had to fail over to Oregon. Their website had a message that said the site was in read only mode. You couldn't log in, post new questions, or answer questions.

Implementing read only mode could be as simple as changing the permissions for the user that your site uses to access its database. For MySql that might be:

REVOKE INSERT ON *.* FROM 'mysite'@'localhost';
REVOKE UPDATE ON *.* FROM 'mysite'@'localhost';

Then users would see error pages when they try to update content. A more user friendly approach might be to show an error message and configure the web application not to allow data changes during this period.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.