Migrating Wordpress From Unix\Linux to Windows Server 2008
There are a lot of guides available for migrating WordPress from a Windows web hosting server to a Unix based server. This article will focus on the reverse; a complete guide to moving WordPress from Unix/Linux to Windows Server 2008.
Prepare a Development Site
On your Windows server, use IIS or the hosting control panel available to you to create a development site. For example: http://yourdomain.devserver.com. When creating the dev site, assign it a dedicated App Pool using ASP.NET 2.0 (Integrated). If you don't have access to controlling App Pools, that's ok, the default setup should work fine.
To start, you'll need a number of software suites installed on the Windows server. The easiest way to get the required software is to use the Web Platform Installer in IIS. The following software is required to run WordPress on Windows Server 2008 R2:
The Web Platform Installer (WPI) makes it easy to install all of the above software in one batch. Launch the WPI and once opened, selected the Applications category. Locate WordPress and click 'Add' to the right. Finally, click the 'Install' button. WPI will now check the server for the required software. If you already have all the required software installed, the WordPress download will start immediately. If not, WPI will notify you of the missing software and will automatically add those packages to the download.
Let WPI install the required software. If necessary, the installer may require your input when setting up MySQL. A server reboot may also be necessary depending on what is being installed. Once all of the required software is installed, the WordPress configuration window will be displayed. Select your development domain from the 'Web Site' drop-down menu. Lastly, remove the value from the 'WordPress application name' text field and click 'Continue'.
WordPress will now be installed on your development domain. When the installer is finished, it will open the default web browser on the server and launch your development domain. There is no need to complete the WordPress setup at this time. Close the browser for now.
Make a Backup of the Live WordPress Site
The next step is to make a backup of your live WordPress site on your Unix/Linux server. I recommend using the free plugin: BackWPup. Once installed, create a backup job. Check all boxes in the 'Job Tasks' area. In the 'Job Destination' area, select 'Backup to Folder'. Run the job and download the backup file to your computer. Finally, FTP the backup file to the Windows server.
Install your WordPress Backup on the Windows Server
This first step is important, please follow it carefully.
Go to your development file space where WordPress has been installed by WPI. Open the wp-config.php file and make note of the following variables:
Once you have recorded that data, you can delete all the files installed by WPI in your development file space except the web.config file. Extract the backup file from your live WordPress site into your development file space. Once again, open the wp-config.php file and replace the above variables with the data you made note of earlier. What you are doing here is replacing the database file name, username, password and hostname specific to the Windows server.
For DB_HOST, WordPress seems to run faster when using 127.0.0.1 instead of localhost.
Next it's time to launch the WordPress installer. Launch your development domain in a web browser and follow the instructions until the WordPress setup is complete. When done, log into WordPress.
Once logged in, you'll notice that your content, plugins and media is not present. This is normal because we have not yet restored the database. To restore the database, I recommend using the WP-DBmanager plugin. Install the plugin, and once installed, close your browser for now.
Update your Database File
The database file created by BackWPup will contain data specific to the live site domain and file structure. It's important that we update this data before we import it.
Locate the database backup file in the root of your development file space. It will have a '.sql' extension. Move this file to the '/wp-content/backup-db/' folder that WP-DBmanager created. Using a modern text file editor such as Notepad++, open the database backup file. Do a document wide search for your live domain name EG: www.yourdomain.com. Replace and occurrences of this domain with the development domain EG: yourdomain.devserver.com. This is important because once you restore the database, if your live domain name is present, WordPress will attempt to connect to that domain instead of your development domain.
Next, do a search for file paths that are specific to the Unit/Linux server. Replace these paths with those used by the Windows server. EG: /home/var/user/http_root/wp-content/ would be changed to EG: D:/websites/user/wwwroot/wp-content/.
Once you made all the necessary updates, save and close the file.
Restore the WordPress Database
Log into WordPress on the development site. Locate the Database section in the left sidebar and choose the 'Manage DB' option. The database file your edited should be listed here. Select the file and choose 'Restore'. The database will now be restored. Once complete, reload WordPress. You should now see your Pages, Media & Plugins etc.
Depending on the setup of the Unix/Linux site, you may still need to update some media file paths etc. Check your development site thoroughly and make updates as needed.
Once you have the site running smoothly, you can now point the DNS for your live domain to the windows server. To make WordPress on the development server recognize your live domain, you will need to update your WordPress domain settings. Go to the 'Settings' section. In the 'General' area, update the following fields:
In these fields, remove the development domain and add the live domain.
Prepare a Live Site Space
Use IIS or the hosting control panel available to you to create a site for the live domain. When ready, move the entire development domain file space to the live file space.