Friday, June 27, 2008

GoDaddy Hosting Issue - "Downgrading" from Windows server to Linux

A client has a GoDaddy shared hosting account, hosting several domains on a MS Windows server. I needed some functionality which is only available on a linux server, so I went to the GoDaddy control panel and "downgraded" to linux. Technical support assured me that the conversion would be seamless, and although the transfer to linux would take 24 hours, the website wouldn't be interuppted (and I had no asp scripts to worry about).

Needless to say, the _entire_ site, including several domains, broke completely upon transfer.

The way the GoDaddy sets up multiple domains under one account is to have the main domain as the "root", and subsequent domains are mapped to subdirectories (from the control panel). For example, here is a typical directory structure:

  • /index.html serves http://domain_1.com/index.html
  • /domain_2/index.html serves http://domain_2.com/index.html
  • /domain_3/ serves http://domain_3.com/index.html
In other words, additional domains within a Godaddy account are mapped to subdirectories of the main account.

What broke during the switch from windows to linux server was this mapping. So while I could access http://domain_1.com/domain_2/index.html, I couldn't access this same file via http://domain_2.com/index.html (like it did before the transfer).

Technical support said I would have to way for up to 3 days for everything to straighten out. As these were high-traffic commerce sites, 3 days was unacceptable. So rather than changing _all_ the links as suggested by GoDaddy tech support (still leaving the secondary domains broke), I added the following lines to my .htaccess file:


Redirect 302 http://www.domain_2.com/(.*) http://domain_1.com/domain_2/$1
Redirect 302 http://www.domain_3.com/(.*) http://domain_1.com/domain_3/$1


Voila! All the sites (and containing links) were fixed. Note that 302 is for temporary redirects, while 301 is used for permanent redirects. I hope that I will be able to remove the redirects in a couple days, when GoDaddy fixes its internal mapping.

update: Once GoDaddy fixed their mapping, I removed the 302 redirects.

Labels: , , ,