WordPress Permalink structure is important with respect to the Search Engine Optimization (SEO). I observed that most of the WordPress blogs have a Permalink Structure which looks like /index.php/%postname%/. This post will help you to change your permalink structure using the Microsoft IIS 6 server.

  1. Create a “php” file, say ’404_wp.php’, paste the below code and upload it to your wordpress root folder (i.e., in same folder/directory where “wp-config.php” file is located.
  2. <?php
    // Default file for WordPress site, generally "index.php"
    $wpdefault = 'index.php';
    // The name of this file.
    $tempfile = '404_wp.php';
    $_SERVER['SCRIPT_FILENAME'] = str_replace($tempfile, $wpdefault, $_SERVER['SCRIPT_FILENAME']);
    $_SERVER['ORIG_PATH_INFO'] = str_replace($tempfile, $wpdefault, $_SERVER['ORIG_PATH_INFO']);
    $_SERVER['SCRIPT_NAME'] = str_replace($tempfile, $wpdefault, $_SERVER['SCRIPT_NAME']);
    $_SERVER['PHP_SELF'] = str_replace($tempfile, $wpdefault, $_SERVER['PHP_SELF']);
    $_SERVER['PATH_INFO'] = false;
    $querystr =& $_SERVER['QUERY_STRING']; $requesturl =& $_SERVER['REQUEST_URI'];
    $position = strrpos($querystr, '://');
    $position = strpos($querystr, '/', $position + 4);
    $_SERVER['URL'] = $requesturl = substr($querystr, $position);
    $querystr = trim(stristr($requesturl, '?'), '?');
    // Required for WordPress 2.8+
    $_SERVER['HTTP_X_ORIGINAL_URL'] = $requesturl;
    // Fix GET vars
    foreach ( $_GET as $var => $val ) {
    if ( substr($var, 0, 3) == '404') {
    if ( strstr($var, '?') ) {
    $nv = substr($var, strpos($var, '?') + 1);
    $_GET[$nv] = $val;
    }
    unset($_GET[$var]);
    }
    break;
    include($wpdefault);
    ?>

  3. Download and Install Internet Information Services (IIS) 6.0 Manager for Windows XP from Microsoft Site. Alternatively, you can install this from your Windows XP Installation CD.
    Download Link
  4. Go to your Windows Control Panel -> Administrative Tools and open Internet Information Services (IIS6) Manager
  5. Right click Internet Information Services and select Connect
  6. “Connect to Computer” dialog box will open, enter your IIS 6 Server IP Address, and Login Credentials
    (In case, you can’t find the IP Address, you can open Command Prompt from Start Menu and ping your site to find IP Address) i.e. ping wpveda.com

  7. Click OK, so as to connect to your server. The IIS manager will open as shown below.
  8. On left-hand side navigation, click on [+] before Your Server’s IP Address to expand
  9. Click on [+] to expand Web Sites
  10. Right click the name of website on which pretty permalinks need to be enable, and select Properties, which would open the Properties dialog box.
  11. Select Custom Error tabs, and find 404 from the grid.
  12. Click Edit button, you will be greeted by another dialog box. Select “URL” from Message Type Drop-Down, and for URL field, write relative path to “404_wp.php” file, that you have created and uploaded on your server (in step 1) and click OK.
  13. You can see the new “404″ URL in Custom-Error Tab Grid. Close the dialog-box.
  14. Right click the web-site that you have connected to and select Disconnect and then close the Internet Information Services (IIS6) Manager
  15. Login to your WordPress Admin-Panel and change your permalink structure to  /%postname%/ or any other structure as shown below.

This is how you can easily change your permalink structure using the Microsoft IIS server for a good SEO for your blog. Do write your feedback through your comments.