Gokul's Blog

Leave a comment

Url-rewriting with WordPress & IIS-7 & Godaddy

(Please note this article is only for WordPress hosted on Windows Server)

Use the web.config as shown below to achieve url-rewriting with WordPress & IIS-7. You just need the bold part of the web.config mentioned below.

Step-1: First setup permalink from admin console of wordpress (Goto admin console==> setttings=>Permalink settings ==> In Common settings choose Custom Structure and in the TextBox enter  /content/%postname%/

Step-2: Create a web.config using the below contents and place it in the root folder of your WordPress installation.

<?xml version="1.0"?>
        <rule name="wordpress" patternSyntax="Wildcard">
    <match url="*"/>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
    <action type="Rewrite" url="index.php"/>
        <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" />
          <action type="Rewrite" url="index.php/{R:0}" />

.csharpcode, .csharpcode pre
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
background-color: #f4f4f4;
width: 100%;
margin: 0em;
.csharpcode .lnum { color: #606060; }