«

»

Sep
27
2012

WordPress blog migration from Linux to IIS (windows) server

Moving WordPress from Linux to IISHere are some steps to help you migrate your wordpress blog from Linux/Unix based server to windows (IIS) server

 

Step 1 – Backup First

Before you migrate, backup all your wordpress installation files and database.

  • You can use the CPANEL backup wizard utility to create the backup of your site home directory or complete website backup and download
  • Use the same utility for backing up the mySQL database and download
  • Take a backup of wordpress directory alone from your webserver through FTP
  • Finally from the wordpress administration interface use to Tools > Export option to export your entire wordpress posts, tags, comments etc. into an XML file. Later you can import this the same way if required

You may not use all these backups again. But it’s best to back all these things and you may end up needing them badly when you run into some trouble.

 

Step 2 – Transfer & Base Setup

Use FTP and transfer your wordpress files into your new IIS server. Create a new mySQL database instance in your new server. If you configure the database name, username and password same as your previous server you are not required to change the wp-config.php file. But if the database name or login details changed then you will have update that in the wp-config.php file. You may also required to change the DB_HOST value to your server IP Address:DB Port (e.g. 250.250.250. 25:1234) format instead of previous value. The default value in linux based servers will be ‘localhost’ in most cases. I have noticed that doesn’t work in IIS (at least in my case) as is. After the updates, ensure updated wp-config.php file uploaded back into your installed location.

Now you will have to restore your database backup into your new server. If you have the plesk control panel you can open your dbadmin interface and import your previously backed database to overwrite the newly created (blank)database. Once you import correctly all tables and entries will be automatically restored(including your previous user profiles) and your blog will load flawlessly.

Now you can try launching your blog from your new server. If wp-config.php configured properly your blog will load fine. If the database connection attributes not updated correctly, you will get the error message “Error in establishing database connection”. In wp-config.php there is a WP_DEBUG field, you can change it to true and debug the database connection error

 

Step 3 – Finishing Setup

Now that your blog loads fine in your new server there is one final yet important step remains. You will have to create a web.config file. This file is necessary only for IIS server whereas the similar functionality will be configured in linux server through .htaccess file. Get a default web.config file from web.

Refer the sample web.config file format from the post below:

http://snipplr.com/view/58542/default-wordpress-webconfig-file-with-permalinks/

If you are using permalinks or customlinks in your wordpress pages then there is another important step remains. You will have modify your web.config <rewrite> tag correctly to avoid 404 errors. Otherwise all your links will break. Refer the post below for the instructions of how to configure.Don’t add contents of this post to existing the <rewrite>tag. Replace it completely based on the post below (there should be only one <rewrite> tag in web.config file)

http://www.iis.net/learn/extensions/url-rewrite-module/enabling-pretty-permalinks-in-wordpress

The correct format for web.config to handle permalinks will be as shown below:

<configuration><system.webServer><rewrite><rules>

<rule name=”Main Rule” stopProcessing=”true”>

<match url=”.*” /><conditions logicalGrouping=”MatchAll”>

<add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true” />

<add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true” />

</conditions>

<action type=”Rewrite” url=”index.php” />

</rule>

</rules>

</rewrite>

</system.webServer>

</configuration>

There is one final step remains, you will notice that your wordpress blog will not able to perform any file handling operations in your new IIS server such as adding/removing plug-ins, updates and whenever you attempt these actions, you will receive the access denied error. To fix this issue, you will have change the directory permissions for the IIS user. You can update the permissions from your IIS control panel virtual directories area.

Now you should be all set and your blog should work properly just the way it was in your old linux server. You will just have to test various pages and links and ensure nothing breaks.

 

Did you find this post useful? Feel free to share your feedback in the comments area.

You can find more interesting posts from us on the posts index section

If you are interested to be notified for the new posts from us, then you can make use of the subscribe option available on the right sidebar.

Help us to improve our search rating by recommending this post to Google using the button below

 

3 comments

  1. Jason says:

    Will these steps work if I have an entire wordpress website?

    1. electron says:

      yes definitely it will apply to the entire website or for a sub-domain

  2. JayGee says:

    This is a start, but leaves many details unresolved, depending on the configuration of the Windows computer.
    My computer already has IIS, PHP and MySQL installed with various websites in folder C:/inetpub/wwwroot. If not, there are many more things to set.
    WP download/install installed itself in folder My Web Sites and created a database etc and worked: brought up the dashboard etc. Quite impressive, but not what was needed.
    So make all the backups etc.
    Add a folder to wwwroot and move using ftp the wp files from the linux server to that folder.
    Use ftp to download a backup of the database .
    Use MySQL Manager to create a new MySQL database.
    Populate the database from the backup (source = backup file).
    It is necessary to ensure that WP, IIS, PHP and MySQL all have the correct settings to communicate. IIS manager can do most of this.
    Add the website to an application pool.
    Set permissions and users for the website folder.
    Verify the handler mappings.
    Verify PHP management settings.
    Edit wp-config file to set database name password, user etc.
    Add a web.config file to the folder so IIS knows where to start, probably index.php.
    Add an Index.php to start WordPress.

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>