in tip, web design

Lessons on switching hosts, migrating WordPress

I had two problems with this website over the weekend.

First, I was unable to view or send files to this site for over 48 hours. I was able to see my files via the online ‘control panel’ of my web host. However, I could not connect using HTTP (viewing from a web browser) or FTP (transferring files using an FTP application). I only had this problem for this specific website. My internet connection was working just fine, and I could connect to my other sites without a problem.

Second, when I viewed the files for this site via the online host ‘control panel’ of my web host (during the period of no-access, I could still see the files this way and only this way), I discovered that my style sheet…the one I had painstakingly and lovingly created over weeks…was zero kilobytes in size. All of my CSS information was gone. My most recent backup was a week old, and I had changed a lot during that week. Mea culpa. I probably will never know why this file was erased. It could have been an FTP transmission error, it could have been the fault of the (previous) company hosting this site. The point is it does not matter – I should have had it backed up.

I’m happy to say that my problems are solved. My connection is up and running on a brand new web host. I decided to switch to a new host as a result of this bad experience. I also have my style sheet back in order, which I had to manually re-create. Here are the lessons learned.

Lesson #1

If you’re having a weird connectivity problem, check your router first (if you have one). It turns out my problem was not with my service provider, but was with my router. For some reason it was blocking my access to this specific server space on my web host only. My host (1&1) never figured this out, and I wasted a weekend talking to tech support. All they could tell me was that it must be my problem because they could not find any errors on their end (more on how they told me this later).

My solution was not as simple as resetting the router. I tried this early on. I unplugged it, then plugged it back in. I rebooted my mac. I tried to force a change to my external IP address in case that address was being blocked by 1&1. Nothing worked. Then, over two days later, I thought, ‘Hey, what if I plugged my Ethernet cable directly into my primary mac?’ If you are a network-saavy person, perhaps that would have been the first thing you might have tried. For me (definitely not network-saavy), it didn’t occur to me to take the router entirely out of the equation. Why? I had online access for all my macs in the house through this router, and I could access all sites … except this ONE SITE. I thought resetting it would fix any issues.

At any rate, my connection worked just fine after I connected my ethernet directly to my mac, and now I had isolated the problem to my router. The lesson here is this: if you try resetting your router and rebooting your mac and you still have a connectivity problem, it’s worth a shot to take your router out of the loop to see if that helps (and thus isolate your problem). This is easy to do and it’s a good first step before you call tech support. In my case, I discovered that there was a firmware update available for my router (I’m using the Linksys WRT54G). Once I updated my firmware, the problem was solved. I’m not sure if the fix was the firmware or because the firmware wiped out some corrupt settings or data. In either case, I learned that there is no way to tell if you router is up to date unless you go online and manually check. There’s no auto ‘check for update’ feature in this wireless router model, at least.

Since we’re talking about routers, I’ll add that a hardware router is your best firewall defense – it effectively hides your internal addresses and devices from the outside world. In other words, all the outside world sees on my home network is my router – nothing else. It’s worth getting one, in my opinion; and it’s necessary if you want wi-fi in your home and/or you are sharing one connection with multiple macs). The built-in Mac OS firewall is good (don’t forget to TURN IT ON – it’s not on by default when you install Leopard!), but you’re first and best line of defense is a hardware router. My Linksys was cheap ($50) and it’s worked well for me, save for this weekend. When I’m in the market for a new wireless router, I think I’ll go with an Apple product. Why? Ease of setup, ease of configuration. Period. If you have a Linksys, you know what I mean. The browser-based interface isn’t very intuitive. (Note to Linksys wireless router owners, check your web-based admin panel for the link that says ‘firmware update’ if you find you need such an update. It’s pretty straight-forward).

Lesson #2

Choose a web host carefully.

Cheapest is not always best. I know this to be true, but I admit I choose 1&1 because of the price. I have to say it worked well for me until I needed support. I called 1&1 three times this weekend. Each time, a live person answered the phone within a minute. That was impressive, but my experience went downhill from there. When I called 1&1 on Friday, I was told to wait four hours before trying to connect to viewfromthedock.com and it would probably work. When I tried to get a bit of an explanation of why this might be so, I was told that I must have been trying to connect to my files too many times in too short of a period of a time. Because of this, my IP address was temporarily blocked. I thought this was strange, since I was doing nothing out of the ordinary. Alas, twelve hours later I had the same problem. I called 1&1 again. This time I was asked to try a ‘traceroute.’ The tech support guy then proceeded to explain how to do this on a PC. When I said I was on a mac, he told me to forget it and that my issue would be sent to ‘Level 2’ tech support. I was also told I would be contacted. Lastly, he told me to wait for 24 hours until I tried to connect to my site again. Quite frustrating. I was annoyed that I still could not transfer files to my site. And I was annoyed that my use of a mac seemed to stop tech support dead in their tracks – this despite me telling him that I knew how to do traceroute and could take a screenshot for him of the result. By Sunday night, I had still not heard from anyone, so I called again. This tech support helper seemed to have no prior knowledge of me ever contacting 1&1. I don’t blame him, of course. I do fault whatever tracking system they are using. All he could tell me was that the problem was likely located at my computer, not with 1&1. This was actually quite helpful, and led me to the router solution. I then switched to 1&1 to Bluehost.

Why? I had actually been pondering a move to this hosting company for a while. This gave me the push I needed. Bluehost is known for good customer service, and they are known to be mac-friendly. The biggest reason for me, though, is that they support Ruby on Rails development. 1&1 does not officially support this. Since I’m trying to learn Ruby on Rails, it made sense to jump to a host with good built-in support. Price-wise, it’s not that much more expensive if you sign up for the two-year package. I’m not crazy about the two-year lock-in, but it did lower the price to the equivalent of $6.95 a month. That equates to $50 more than 1&1 for a two year time block. Not too bad. The control panel is a little confusing. My friend Brandon, a Bluehost user, pointed this out. The vote’s still out for me. I can say that I love the ease with which one can backup files and databases with Bluehost. As you might imagine, I checked out this feature first! I’ll post on my Bluehost experience more at a later date after I’ve used it for awhile. I think the web is lacking good third-party reviews of hosting services. If you’ve ever searched for an independent review of a web host, you know what I mean. Search engines generally return dubious ‘top 10’ lists — I say ‘dubious’ because I don’t trust these sources.

Lesson #3

Transferring a WordPress installation from one host to another is surprisingly simple.

The easy part is copying all your WordPress files from the old server to the new one. There’s nothing to it: you just copy them over. The more difficult part is transferring your MySQL database. Conceptually, it goes like this: you copy all of your files over. Then you export your MySQL database that holds all your WordPress posts, comments, etc. Then you import that information into a new MySQL database on your new host. Lastly, you change your WordPress configuration file so it properly points to this new database (if you use WordPress, this is the same wp_config.php file that you modified when installing WP. I’ve included four screenshots here to illustrate what this looks like. Note that your host may have a set-up that looks different than mine, but the options will be the same if your host uses MySQL and phpMyAdmin. For a quick checklist, check out these WordPress Codex instructions.

Lesson #4

Develop your site design locally on your mac, then transfer the finished theme over to your live site. Fortunately, this is easy on a mac. Why did I not do this for my site? I actually did, but once I uploaded my ‘finished’ theme I decided to totally change it. I was lazy, in short. I decided to just kept editing my live WordPress installation directly on the server using the Panic Transmit. The easy mac solution for running a virtual server on your mac is called MAMP. It’s dead simple to set up. It includes a dashboard widget that allows you to easily start and stop your local server. What a cool tool. And it’s free.

That’s it for this post. Oh, and don’t forget to back up your data .