Port WordPress/Joomla from Apache to IIS 7

Posted: May 24th, 2010 | Author: | Filed under: Test Lab | Tags: , , , | 4 Comments »

This WordPress blog as one Joomla website that I maintain, have been until now on Linux hosting and I decide it to port them to my Windows hosting provider. My Windows hosting provider of choice is Arvixe, I really like Arvixe because they are following new technologies, that I need. They even supporting .NET 4 Framework, ASP.NET MVC, Unlimited SQL Server database as olso unlimited MySQL 5 database.

So, how to port the widely known blog engine and CMS. It is very easy, because in my case Arvixe have installed Rewrite Module for IIS 7. Porting was easy, I just move the files from Linux server to Arvixe Windows server, and also create new database, dump old and import it to new, easily done with phpMyAdmin.

But, all the problem, is to port .htaccess and rewrite script in to the IIS Rewrite script. No big deal each site have scripts available, for the IIS (and Apache). In case of WordPress all is needed to put in web.config inside <system.webServer>:

<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" />
        </rule>
    </rules>
</rewrite>

And in case of Joomla, same thing but little different script and include disable chache for php:

<rewrite>
    <rules>
        <clear />
        <rule name="Common Exploit Blocking" stopProcessing="true">
            <match url="^(.*)$" />
            <conditions logicalGrouping="MatchAny">
                <add input="{QUERY_STRING}" pattern="mosConfig_[a-zA-Z_]{1,21}(=|\%3D)" />
                <add input="{QUERY_STRING}" pattern="base64_encode.*\(.*\)" />
                <add input="{QUERY_STRING}" pattern="(\&lt;|%3C).*script.*(\>|%3E)" />
                <add input="{QUERY_STRING}" pattern="GLOBALS(=|\[|\%[0-9A-Z]{0,2})" />
                <add input="{QUERY_STRING}" pattern="_REQUEST(=|\[|\%[0-9A-Z]{0,2})" />
            </conditions>
            <action type="Redirect" url="index.php" appendQueryString="false" redirectType="SeeOther" />
        </rule>
        <rule name="Joomla Search Rule" stopProcessing="true">
            <match url="(.*)" ignoreCase="true" />
            <conditions logicalGrouping="MatchAll">
                <add input="{URL}" pattern="^/search.php" ignoreCase="true" />
            </conditions>
            <action type="Rewrite" url="/index.php?option=com_content&amp;view=article&amp;id=4" />
        </rule>
        <rule name="Joomla Main Rewrite Rule" stopProcessing="true">
            <match url="(.*)" ignoreCase="true" />
            <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                <add input="{URL}" pattern="(/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$" />
            </conditions>
            <action type="Rewrite" url="index.php/" />
        </rule>
    </rules>
</rewrite>
<caching>
    <profiles>
        <add extension=".php" policy="DisableCache" kernelCachePolicy="DisableCache" />
    </profiles>
</caching>

Hope it helps!


MySql Connector/NET 6.3.1 and Visual Studio 2010, what a mess

Posted: May 21st, 2010 | Author: | Filed under: Test Lab | Tags: , , | 4 Comments »

I just survived a real mess of installing latest alpha MySQL Connector for .NET (6.3.1), first when I downloaded it from, I think German mirror (SUNSite) there was no .msi file in mysql-connector-net-6.3.1.zip  only files like ones in “-noinstall” version. But after googling for an hour, found an .msi one version to download.

But, that is not all, running mysql.data.msi was not installing the product, it rollbacks the installation, with no error message at all. So I found one post on MySQL forum, one good soul has tried to debug Connector/Net on installation and found problem of “Config” folder in .NET Framework folders (x:\Windows\Microsoft.NET\Framework) .“Config” folder is only in CLR changed frameworks – 1.0, 1.1, 2.0, 4.0).  The problem was easily solved by renaming “Config” folder, for installation only, after renamed back to “Config”.

He (the guy from forum post) has problem with v1.1.43222, probably because he has one installed, I didn’t, so this wasn’t my problem, so I was stuck with this. But as I was reading through all replies (about 20+) to this post in forum, there was one reply, saying to rename all “Config” folder inside “Framework” folder.

This was like eureka to me, so I saw something interesting in “Framework” folder. Since I was following .NET 4 Framework from its early stages, I have had three “old” folders in it:

  • Old_v4.0.20506
  • Old_v4.0.21006
  • Old_v4.0.301280

And all of this folders have “Config” folders. I renamed it all to “Config0”, and only one not renamed “Config” folders was:

  • v2.0.50727
  • v4.0.30319

Now, mysql.data.msi installs just fine and there are no more mess with Connector/.NET, and everything works fine from integration with Visual Studio 2010 to using MySQL with POCO feature in Entity Framework 4, now available with .NET 4 Framework only.