Technical notes on WordPress when switching hosts or URLs

Generalized, here’s the process I used to move Waffle from my old host to my new host:

  1. ‘Dump’ the database - saving everything into the SQL queries needed to re-construct the database. This is available from the excellent online database manager PHPMyAdmin or the bundled command line tool mysqldump.
  2. Download all the files from the old server (fairly naturally). (It’s important to do the database dump the very first thing you do before this step; if it takes a long time and your old host close on you, there’s a fair chance there’ll be database data you won’t have, but there’s a good chance you already have your files on your hard drive.)
  3. At this stage it might be tempting to upgrade to a newer version of WordPress immediately. However, I recommend getting your current version up and running first, if for no other reason than to see that everything basic still works. So, instead of upgrading right now, edit wp-config.php to point to your new database (create this new database using your host’s admin tool if you haven’t already).
  4. Upload the old files to the new server.
  5. Restore the database. Possible tools include:

    • The aforementioned PHPMyAdmin
    • The mysql command line tool on the new server (via ssh or telnet)
    • In combination with the uploaded dump called “tempfile”, a simple PHP script along the lines of

      < ?php mysql_connect(host, name, password); mysql_select_db(database); mysql_query(implode('',file("tempfile"))); ?>

      (For many reasons such as security and not running it again after two months having it duplicate everything, remember to delete the script and the uploaded dump (”tempfile”) immediately after it’s been run.)

If you’re changing the URL of your set up, remember to take these steps:

  1. In the options table, change the row with the option_name “siteurl” to have the option_value of your new URL. (If a row exists with the option_name “home”, change that one too.)
  2. If you can have an .htaccess file (if you’re on Apache) and you use the Permalink Structure feature to make nicer URLs, make sure that file gets rewritten by re-saving it. (Remember to set the correct permissions of the .htaccess file, since normal permissions will not normally allow WordPress to rewrite the file.)
  3. If you have mod_redirect, use this .htaccess file in your old URL root to redirect any request to that URL to the new URL:

    RewriteEngine On
    RewriteRule ^/(.*)$ http://your.old.url$1

    If your new path is not at the root of a domain, insert RewriteBase /path/to/new/path in between. (Be sure to leave off the trailing slash.)

Dreamy

Waffle is back. Why being away in the first place? Switching hosts, that’s why.

Bye-bye to JaguarPC (née Aletia) and their 2003-ish feature set. Hello, Dreamhost with constantly increasing (and huge to begin with) bandwidth and space allowances, as well as features. From what I’ve seen so far, it’s lovely.

(Disclosure: The Dreamhost link above will refer to me and give me a kickback if you sign up after clicking that link. That’s not why I’m speaking well of them - the awesome service that I’ve gotten from them and the nice bang for the buck is why.)

Update: Now, all URLs at the (henious) old URL will direct to this one. Including RSS/Atom feeds (hopefully).

Defenestration

August 11, 2003. Blaster (aka MSBlast) hits thousands of Windows 2000 and XP machines worldwide through an un-patched hole, allowing so-called “execution of arbitrary code”. Months earlier, and years later, similar worms, viruses and opportunist trojan horses (including spyware) continue to plague computer users, and especially those running later versions of Windows hooked up to high-bandwidth connections (”broadband”).

Except for the iconic “BEEP BEEP BEEP”, what these worms can do are not very far from the vision put forth by the “Switch” ads from Apple, Ellen Feiss’s one in particular. Media coverage has been sporadic, mostly covering the worms that easily got hold because of weak security on a widely-spread OS run on computers with constant and capable internet connections. Between Blaster (one of the first widely known and bad-enough worms of its kind) and a few months following the release of Windows XP Service Pack 2, coverage peaked.

However, Windows XP Service Pack 2 was relatively late. People had had time to look for alternatives, such as different incarnations of the “Desktop Linux” vision and the apparently newer Mac OS - weren’t Macs things with snotty commercials and users but incompatible standards? Meanwhile, worm “deployment” reached the levels where almost everyone - computer literate or not - had seen the brand-new-Windows-box-put-online-and-controlled-by-viruses-in-minutes scenario. As better writers than yours truly have written, the masses were restless.

June 6, 2005. After months of speculation, Apple announced their plans to over time migrate their Mac computer lineup from PowerPC processors (built by IBM and Motorola offshoot Freescale) to processors built by Intel. Speculation is rampant as to why. Steve Jobs, CEO of Apple, is quoted as saying “As we look ahead, we can envision some amazing products we want to build for you, and we don’t know how to build them with the future PowerPC roadmap.” (Original emphasis.)

In the following months, speculation about why Apple would want to do this remains rampant. One factor is known, and demonstrated by Steve Jobs himself at the WWDC keynote: power consumption in relation to performance, which, when comparing integer performance, nets Intel much more of these units (70) than it does for the future projected unnamed PowerPC roadmap (15) in mid-2006. “But,” the web collectively speculates, “there’s gotta be more.”

Which brings us to the present day - early November 2005. Windows users have added “checking for spyware” to the list of tedious-but-necessary maintenance tasks regularly needed (joining anti-virus measurements and updating (and patching) software) and gained a bit more knowledge on security maxims, such as “the first rule of Fight Clubinternet-connected computers is you do not run internet-connected computers without a firewall”. More people than ever are checking out alternatives to the Windows monopoly - effective web applications (like the still-in-beta Gmail) are now replicating a big enough part of the desktop equivalent that people consider using it instead, and Apple has declared two consecutive quarters the best ones in company history.

Windows Vista (previously mostly known as Longhorn), the next Windows version and one that supposedly will deliver vast security enhancements, is still several quarters away. For pretty much the first time in Windows’ history, usage is going down. People are seriously considering other alternatives, when three years ago, they might not have. Microsoft are not screwed by any remotely imaginable vision, but things are not going up-up-up for the first time in forever.

Let’s now predict the future: Apple or its supportors will, in a devastating blow to the Microsoft Windows product (not to the Windows platform), make Windows applications run, unmodified, on Intel-based Macs, under Mac OS X.

It’s not a bold prediction. Wil Shipley, long-time creator of NeXT and Mac OS X software, was one of several thousand people to beat me to it. A product called Darwine has for over two years aimed to adjust the Linux/*BSD-native WINE - the engine that looks and quacks like Windows to Windows applications which makes them run - to OS X.

(Yes, WINE has been available for Linux/*BSD for quite some time now. Why hasn’t Linux/*BSD grown significant market share, then? Linux/*BSD have combined around 90% to 200% of Mac OS X’s market share, depending on who you ask and how you phrase it, but that includes every Linux/*BSD server ever, and doesn’t negate that Mac OS X is a tremendously usable desktop environment and most copies of Linux/*BSD in circulation are not.)

It’s not a bold prediction at all. However, it will be a bold move, and it will be taken, either by Apple, by volunteers or by commercial parties like CodeWeavers using and profiting off of WINE.

What does this mean for Apple? It means that if commodity Windows software can reliably run on Mac OS X with a very small performance hit, if any, and if most people only run commodity software, and if hardware choice is not a problem, there is, aside from liking Windows as an environment, effectively no reason for these people to not run Mac OS X instead.

Here’s Apple’s official Switch-to-Intel plan today:

  1. Switch to Intel.
  2. Get more performance per watt and higher chip volumes.
  3. Profit!!!

If there’s a step 2.5, taking the plan, adding something and running with it, I don’t see why this couldn’t be the revised plan:

  1. Switch to Intel.
  2. Get more performance per watt and higher chip volumes. 2.5 Make running unmodified Windows applications on OS X possible.
  3. Profit!!!

Of course there’s a backlash. What if people start using just Windows apps - killing the market for special-made Mac apps even more, turning OS X into just another Windows version? And what if people simply just won’t run out in droves to buy Macs, however cheap, to run Windows apps on OS X? And what if Microsoft withdraws Office for Mac, leaving only the full-featured, but ’strange’, Windows version?

Five years ago, this would be an accurate list of what Apple did not have: a primary OS with preemptive multitasking, a ‘meet-you-halfway’ two-button mouse, a market-leading online music store, a market-leading music device and a Mac that cost less than US $500. If there’s one thing that Apple’s not afraid of today, it’s uprooting the old and replacing it without any qualms. I don’t think the new, brave, Apple would have any trouble in going the route outlined and trying to sell people on obsessive-compulsive-like attention to hardware design (the iMac G5 sports an ambient light sensor which dims the ’sleep’ light depending on how bright the room is) and good software, relegating the Windows application compatibility to a deal-clinching detail.

« Newer posts