Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-04-16 11:41:08

mlarino
Member
Registered: 2007-06-29
Posts: 367

web.config in IIS server

This is what I have in my web.config file in a IIS server to make textpattern have clean URLs, but is not working, any ideas?
the textpattern site is in a subfolder.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <remove name="PHP_via_FastCGI" />
            <add name="PHP_asoporcel" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files\PHP\php-cgi.exe|-d open_basedir=E:\WebdeOceans\asesoriadiaz.com\html" resourceType="Unspecified" />
        </handlers>
        <defaultDocument>
            <files>
                <clear />
                <add value="index.php" />
                <add value="default.html" />
                <add value="default.htm" />
                <add value="index.html" />
                <add value="index.htm" />
                <add value="default.aspx" />
                <add value="default.asp" />
            </files>
        </defaultDocument>
    <rewrite>
      <rules>
        <rule name="Security Rule" stopProcessing="true">
          <match url="^(.*)$" ignoreCase="false" />
          <conditions logicalGrouping="MatchAny">
            <add input="{QUERY_STRING}" pattern="mosConfig_[a-zA-Z_]{1,21}(=|\%3D)" ignoreCase="false" />
            <add input="{QUERY_STRING}" pattern="base64_encode.*\(.*\)" ignoreCase="false" />
            <add input="{QUERY_STRING}" pattern="(\&lt;|%3C).*script.*(\>|%3E)" />
            <add input="{QUERY_STRING}" pattern="GLOBALS(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
            <add input="{QUERY_STRING}" pattern="_REQUEST(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
          </conditions>
          <action type="CustomResponse" url="index.php" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
        </rule>
        <rule name="SEO Rule">
          <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" />
            <add input="{URL}" negate="true" pattern="^/index.php" ignoreCase="false" />
            <add input="{URL}" pattern="(/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$" />
          </conditions>
          <action type="Rewrite" url="index.php" />
        </rule>
                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^(.+)" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAny">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
                    </conditions>
                    <action type="None" />
                </rule>
                <rule name="Imported Rule 2">
                    <match url="^(.*)" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
      </rules>
    </rewrite>


    </system.webServer>

Last edited by mlarino (2010-04-16 11:43:42)

Offline

#2 2011-02-01 23:24:28

dhatman
New Member
Registered: 2011-02-01
Posts: 2

Re: web.config in IIS server

I got it to work in IIS7 with http://www.iis.net/download/URLRewrite using http://learn.iis.net/page.aspx/470/importing-apache-modrewrite-rules/.

My site.root/web.config ended up like this:


<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <directoryBrowse enabled="false" />
    <rewrite>
      <rules>

                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^(.+)" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAny">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
                    </conditions>
                    <action type="None" />
                </rule>
                <rule name="Imported Rule 2">
                    <match url="^(.*)" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
      </rules>
    </rewrite>

    <httpErrors>
      <remove statusCode="404" subStatusCode="-1" />
      <error statusCode="404" prefixLanguageFilePath="" path="/index.php" responseMode="ExecuteURL" />
    </httpErrors>

    <defaultDocument>
      <!-- Set the default document -->
      <files>
        <remove value="index.php" />
        <add value="index.php" />
      </files>
    </defaultDocument>
  </system.webServer>
</configuration>

Last edited by dhatman (2011-02-01 23:30:46)

Offline

Board footer

Powered by FluxBB