When I first asked to migrate a linux based wordpress site to windows server, I was really wicked. Because there was plenty of challenges in front of me,
- Site is up and live, I shouldn’t down the site for long time.
- WordPress, Mysql and all PHP stuffs goes well with linux but not with windows.
- I need to move all the wordpress posts and pages without any blunder.
- I should maintain the existing URL for all the pages.
Now I relaxed and took long breath. Ok. Before starting the process my mind was asking me to hatch a plan. So here are the plans,
- Backup the entire wordpress folder
- Export the mysql wordpress database into a sql file format
Since I was given by windows server 2008 R2. I have the privilege to install anything I wantJ. So my first plan is to install the Xampp or Wamp in the windows server. These web servers are nothing but a package of Apache, Mysql and PHP. When installing I should make sure that the web server should run on port 80 which is http’s default port. After installing it is just copy and paste the linux wordpress site into the httpdocs folder. Import the mysql database into the installed web server using the command mysqldump. If you bit scared about the mysqldump command install mysqlyog or Mysql Work bench GUI software it is like standalone format of PHPMyadmin.
OMG !. This looks very easy and I excited J but the problem is, the windows server is going to have two websites running on the same server. One is dot net application which needs IIS as a web server to run and other is our wordpress site which runs under the apache as a web server. So I don’t want to run two different web server and to change the configuration to run two different website. Running a two web server is cost some amount of server load too. So then what is the next plan ? How about running PHP on IIS. Yes it is possible to run PHP script under IIS.
We need to install the PHP and myql manually in windows server. After that we need to configure php to run on IIS instead of typical apache web server. Since it is a windows server we can enjoy the GUI by installing some software like SqlYog or Mysql Workbench to ease the mysql database import process. Now the big problem is about the URL retention basically apache supports mod_rewrite package where we need to create a .htaccess files to save the url rewrite rules. Since it is not a fresh wordpress installation I already have my .htaccess with the plenty of URL’s already written.
IIS on windows knows only the web.config file and it never recognize the .htaccess. There is an option where we can change the .htaccess rules into set of web.config things. So initially I thought of changing this rules one by one manually. I have given a google search to ease the process and where I came across a beautiful plugin called ISAPI_Rewrite for IIS. But digging deeply I found a better solution with the different plugin called Helicon Ape that too developed ny the same company. Once you install the plugin, the IIS in default detects the .htaccess and rewrites the entire URL. Wow it is great news for me. But I never believed this tool. I gave a try on this. After installing the tool it worked flawlessly.
At last I took my hands back from the windows server 🙂