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!


4 Responses to “Port WordPress/Joomla from Apache to IIS 7”

  1. 4
    Matt Says:

    Hi,

    I am interested to know if you have got the Joomla web.config running on arvixe, or simply copied from another website? I am having extensive trouble getting it working. The links simply revert to the main page if i turn URL encoding on in global config. I have read dozens of forums, and am startign to thinks its because Arvixe arent using FastCGI. do you have any input? Have you got joomla working with url encode and SEF urls???

    Thank you.

  2. 3
    cocktail dresses, cheap cocktail dresses Says:

    You are really a good webmaster. The site loading pace is incredible. It seems that you’re doing any distinctive trick. Furthermore, The contents are masterpiece. you have done a great task in this subject!

  3. 2
    mihana Says:

    about korn

  4. 1
    Richard Novi Says:

    Great blog=D Will take a bit of time to entertain this site!!

Leave a Reply