Gokul's Blog

Leave a comment

Source code formatting in wordpress


[ sourcecode language="javascript"]
 // javascript hello world program
 alert('Hello, World !!');
[ /sourcecode ]

For C#: 
[ sourcecode language="csharp"]
[ /sourcecode]

Leave a comment

Install WordPress multisite on Windows server 2003

Main Link


Step 4 – Download and Install ISAPI Rewrite

The biggest challenge with getting IIS 6 to work with WordPress is that Windows does not have a native ISAPI rewrite filter in the web server. You have to download and install one. There are many choices, but Ionic’s ISAPI Rewrite Filter is free and it works, so why make it complicated, use this…

Click here to download Ionic’s ISAPI Rewrite Filter. Download the installer and run it on your web server.

Step 6 – Activate Multisite in WordPress

WordPress Multisite gives you 3 choices of how to differentiate your multiple websites: subdomain, subdirectory, or domain mapping. For simplicity, I chose to go with the subdirectory option because it uses the ISAPI rewrite filter that we have already installed, and it requires no further installations.

NOTE: If you have to go with the subdirectory option, it involves wildcard directories, and you can click here to read about how to set up wildcard subdomains for WordPress. If you have to go with the domain mapping option, you can click here to read about how to set up domain mapping in WordPress.

So as I said, I went with subdirectory differentiation for ease of installation, and it seemed to be more compatible with IIS since it required fewer installations. In fact, we are done with all the required installations, and we will now only need to modify some code to finish up.

Add this line to your wp-config.php file and save the file:

define(‘WP_ALLOW_MULTISITE’, true);

On the left column in the dashboard, you will see a new link called “Network” under “Tools.”  Disable all of your plugins, and then click the “Network” link. Select “Sub-directories” for the Network type, give the network a title, and enter the admin e-mail address.

NOTE: If you see this error it’s because you installed WordPress more than 30 days ago: “Because your install is not new, the sites in your WordPress network must use sub-domains. The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.” The work around solution is simply to ignore this message and change the line in the wp-config.php file that says “define( ‘SUBDOMAIN_INSTALL’, true );” to “define( ‘SUBDOMAIN_INSTALL’, false );” but be sure you backup your database before you try to go this route. If you are very worried about it, and you have a lot of posts, then you should consider using subdomains or domain mapping instead of subdirectories.

After you select the network type, title, and email, WordPress will display the code that is required for the wp-config.php and for the ISAPI rewrite filter. Copy the code that WordPress provides into the wp-config.php file as the WordPress directions explain. WordPress assumes the third chunk of code will be put into a file called “.htaccess” which would be correct if we were using Linux. Since we are using IIS 6 with the ISAPI filter we installed in step 4, we save the code that WordPress supplies for “.htaccess” but we save it in a file called “iirf.ini” and place that on the root of your WordPress web server.


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

Leave a comment

Handy WordPress Scripts

To delete the table from MY-SQL database

DROP TABLE IF EXISTS `wp_comments`;
DROP TABLE IF EXISTS `wp_options`;
DROP TABLE IF EXISTS `wp_postmeta`;
DROP TABLE IF EXISTS `wp_term_relationships`;
DROP TABLE IF EXISTS `wp_term_taxonomy`;
DROP TABLE IF EXISTS `wp_usermeta`;


Get current physical dir in PHP (similar to server.mappath)


// current directory
echo getcwd() . "\n";