• Modx on IIS7#

  • sym Reply #1, 2 years, 3 months ago

    Reply
    Having worked with both Helicon rewrites and the native rewrite engine developed for IIS7 I must say the URL Rewrite Module is a lot more powerful and versatile, some software it does not seam to work with very well, like magento and even Wordpress to an extent was hard to get to work but worked with some necessary tweeks.
    Modx has been the easiest software package to write a set of rules for to date and we are more than happy to share these with the community so people using IIS7 servers can use the SEO links and all the Modx features with no troubles.
    <rewrite>
                <rules>
                    <rule name="ModX IIS7 Rule 1 (By Simon Fraser)" stopProcessing="true">
                        <match url=".*" ignoreCase="false" />
                        <conditions logicalGrouping="MatchAll">
                            <add input="{HTTP_USER_AGENT}" pattern="^.*internal\ dummy\ connection.*$" />
                        </conditions>
                        <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
                    </rule>
                    <rule name="ModX IIS7 Rule 2 (By Simon Fraser)" stopProcessing="true">
                        <match url="^(manager|assets)" ignoreCase="false" />
                        <action type="None" />
                    </rule>
                    <rule name="ModX IIS7 Rule 3 (By Simon Fraser)" stopProcessing="true">
                        <match url="^(.*)$" ignoreCase="false" />
                        <conditions logicalGrouping="MatchAll">
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" pattern="" ignoreCase="false" />
                        </conditions>
                        <action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" />
                    </rule>
                </rules>
            </rewrite>


    We have these rules currently running on two Modx IIS7 based websites and are having no problems at all and can see no difference from our Apache hosted Modx websites.

    Hope this helps anybody having problems with IIS7 rewrites.
    You only need to make sure your host has the URL Rewrite Module installed on their servers, most good hosts will have this already installed.
    http://www.iis.net/expand/URLRewrite


  • deniro0311 Reply #2, 2 years, 3 months ago

    Reply
    I am still getting use to IIS, so forgive the following nobish question. Are you putting those re-write rules in a "web.config" file?

    Thanks in advance


  • deniro0311 Reply #3, 2 years, 3 months ago

    Reply
    Thank you sooooooo much for posting your configs. They work great and have saved me so much time. I simply added them to my "web.config" file in my "httpdocs" folder, and I now magically have user friendly URLs in IIS7.


  • mwalsh Reply #4, 1 year, 9 months ago

    Reply
    Thanks for posting this up, it has saved me a job!


  • mayhemchaos Reply #5, 1 year, 8 months ago

    Reply
    Question about MODx in II7 - we're experiencing some issues with two things: Canonical URLs and the pulgins in the manager not working. Has any experienced that with plugins and also know where to change the canonical URLs?


  • mwalsh Reply #6, 1 year, 6 months ago

    Reply
    I just wanted to share this post as it has provided a solution to a problem I've noticed with Revolution when hosted on IIS7.5 on Windows Server 2008 R2:

    http://mtwalsh.tumblr.com/post/1486756180/modx-404-errors-on-iis-7-5

    And this one:

    http://blogs.iis.net/kehand/archive/2009/08/09/php-and-custom-error-pages.aspx



  • mIDO Reply #7, 1 year ago

    Reply
    And my question is... why this is not in the documentation? :S


  • rthrash Reply #8, 1 year ago

    Reply
    Please help improve the documentation—obviously some good things here to add!


  • tzmedia Reply #9, 11 months ago

    Reply
    Anybody have any suggestions for adjusting this if Revo 2.1.1 is installed in a folder called revo?
    If I place the code in a file at the site root (not the revo root folder sub-directory) called web.config.
    It then prevents me from logging into the manager at all.
    Making a few adjustments where it looked like maybe they should go and still can't log in to manager...
    line 11: <match url="^(revo|manager|assets)" ignoreCase="false" />
    
    line 20: <action type="Rewrite" url="http://www_MyDomain_com/revo/index.php?q=
    {R:1}" appendQueryString="true" />
    


    Anybody's help would be golden


  • UltraSEF Reply #10, 5 months ago

    Reply
    I'm new to administrating IIS7.5. Where exactly do I put your rewrite rules?

    I tried importing them by copying and pasting them into a file named ht.access but the Import function didn't create any rules.