We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27444 ☆ A M B ☆
    • 117 Posts
    Hi,

    I have set up MODX Evo on IIS. URL Rewrite module is switched on and pasted the following in the web.config:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <directoryBrowse enabled="false" />
            <defaultDocument>
                <files>
                    <clear />
                    <add value="index.php" />
                    <add value="Default.htm" />
                    <add value="Default.asp" />
                    <add value="index.htm" />
                    <add value="Default.aspx" />
                </files>     
            </defaultDocument>
            <rewrite>
                <rules>
                    <rule name="Add WWW prefix" >
                      <match url="(.*)" ignoreCase="true" />
                        <conditions>
                          <add input="{HTTP_HOST}" pattern="^example\.com" />
                        </conditions>
                      <action type="Redirect" url="http://www.example.com/{R:1}"
                        redirectType="Permanent" />
                    </rule> 
    
                    <rule name="ModX IIS7 Rule 1" 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" stopProcessing="true">
                        <match url="^(manager|assets)" ignoreCase="false" />
                        <action type="None" />
                    </rule>              
                    <rule name="ModX IIS7 Rule 3" 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>          
        </system.webServer>
    </configuration>


    However, I get the following error:

    Server Error in Application "DEFAULT WEB SITE"
    Internet Information Services 7.5
    Error Summary
    HTTP Error 404.0 - Not Found
    The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
    Detailed Error Information
    Module	IIS Web Core
    Notification	MapRequestHandler
    Handler	StaticFile
    Error Code	0x80070002
    Requested URL	http://localhost:80/corporate/about-us.html
    Physical Path	C:\inetpub\wwwroot\Website\corporate\about-us.html
    Logon Method	Anonymous
    Logon User	Anonymous
    Most likely causes:
    The directory or file specified does not exist on the Web server.
    The URL contains a typographical error.
    A custom filter or module, such as URLScan, restricts access to the file.
    Things you can try:
    Create the content on the Web server.
    Review the browser URL.
    Create a tracing rule to track failed requests for this HTTP status code and see which module is calling SetStatus. For more information about creating a tracing rule for failed requests, click here.
    Links and More Information
    This error means that the file or directory does not exist on the server. Create the file or directory and try the request again.
    View more information »


    I have also tried adding:

    <?xml version="1.0" encoding="UTF-8"?>
    
    <configuration>
    
        <system.webServer>
    
            <httpErrors existingResponse="PassThrough" />
    
        </system.webServer>
    
    </configuration>



    But instead a page blank starts to show.

    Did someone encounter this problem and managed to solve it?

    Thanks smiley
      Steven James McLean
      Tech Lead
      springbokagency.com