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"?>
<configuration>
  <system.webServer>
    <!--<rewrite>
      <rules>
        <rule name="wordpress" patternSyntax="Wildcard">
    <match url="*"/>
    <conditions>
        <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>-->
 
    <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/{R:0}" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>
 

.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; }


Leave a comment

Running Cassini /web dev server from command line

I saw an web-application containing an exe once executed to run the website as a demo using the Cassini web-server.
So I played around a bit to figure out how to achieve the same using a batch file.

Edit Updated Batch File Code:

set appPort=8009
set appPath=E:\Blogengine\BlogEngine.Web

start C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\WebDev.WebServer.EXE /path:%appPath% /port:%appPort%
start iexplore http://localhost:%appPort%/