Jump to content

Windows IIS


Joss
 Share

Recommended Posts

Okay, I am not in a position to test anything at the moment as I don't have the right environment, but I have used the URL rewrite module to do a conversion and the only problem seems to be on line 72 which seems to refer to:

 
  # If any conditions above match, isssue a 403 forbidden
  RewriteRule ^.*$ - [F,L]
 
Anyone know how this effects things?
<rewrite>
  <!--This directive was not converted because it is not supported by IIS: RewriteBase /.-->
  <!--This directive was not converted because it is not supported by IIS: RewriteBase /pw/.-->
  <!--This directive was not converted because it is not supported by IIS: RewriteBase /~user/.-->
  <rules>
    <!--#################################################################################################-->
    <!--# START PROCESSWIRE HTACCESS DIRECTIVES-->
    <!--# @version 2.5-->
    <!--# @indexVersion 250-->
    <!--#################################################################################################-->
    <!--# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--# Don't show directory indexes, but do follow symbolic links -->
    <!--# 500 NOTE: Some cloud hosting companies don't allow +FollowSymLinks. -->
    <!--# Uncomment +SymLinksifOwnerMatch and comment +FollowSymLinks if you have 500 errors. -->
    <!--# If that doesn't resolve the error, then set it back to +FollowSymLinks. -->
    <!--# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--# Options +FollowSymLinks-->
    <!--# Options +SymLinksifOwnerMatch-->
    <!--# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--# Let ProcessWire handle 404s-->
    <!--# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--# Handle request for missing favicon.ico/robots.txt files (no ending quote for Apache 1.3)-->
    <!--# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--# Protect from XSS with Apache headers-->
    <!--# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--# Protect ProcessWire system files (part 1A) for Apache versions older than 2.4:-->
    <!--# APACHE 2.4+ NOTE: Comment out this section and uncomment second 1B below it.-->
    <!--# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--# Protect ProcessWire system files (part 1B) for Apache versions 2.4 and newer: -->
    <!--# APACHE 2.4+ NOTE: Uncomment this section and remove or comment out section 1A above. -->
    <!--# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--# <FilesMatch "\.(inc|info|info\.json|module|sh|sql)$|^(\..*)$">-->
    <!--#   Require all denied -->
    <!--# </FilesMatch>-->
    <!--# <Files .htaccess>-->
    <!--#   Require all denied-->
    <!--# </Files>-->
    <!--# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--# Override a few PHP settings that can't be changed at runtime (not required)-->
    <!--# 500 NOTE: Try commenting out this entire section below if getting Apache 500 errors.-->
    <!--# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--# Set default directory index files-->
    <!--# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--# ProcessWire requires mod_rewrite-->
    <!--# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <rule name="Imported Rule 1">
      <match url=""(^|/)\."" ignoreCase="false" />
      <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
    </rule>
    <rule name="Imported Rule 2" stopProcessing="true">
      <match url="^" ignoreCase="false" />
      <conditions>
        <add input="{HTTP_HOST}" pattern="^www\." negate="true" />
      </conditions>
      <action type="Redirect" redirectType="Permanent" url="http://www.{HTTP_HOST}{URL}" />
    </rule>
    <rule name="Imported Rule 3" stopProcessing="true">
      <match url="^(.*)$" ignoreCase="false" />
      <conditions>
        <add input="{URL}" pattern=""[^-_.a-zA-Z0-9/~]"" ignoreCase="false" />
        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
      </conditions>
      <action type="Rewrite" url="index.php?it=/http404/" appendQueryString="true" />
    </rule>
    <!--This rule was not converted because only some of the conditions are using the OR flag.-->
    <rule name="Imported Rule 5" stopProcessing="true">
      <match url="^(.*)$" ignoreCase="false" />
      <conditions>
        <add input="{URL}" pattern=""^/~?[-_.a-zA-Z0-9/]*$"" ignoreCase="false" />
        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
        <add input="{REQUEST_FILENAME}" pattern="(favicon\.ico|robots\.txt)" ignoreCase="false" negate="true" />
        <add input="{REQUEST_FILENAME}" pattern="\.(jpg|jpeg|gif|png|ico)$" negate="true" />
        <add input="{REQUEST_FILENAME}" pattern="(^|/)site/assets/" ignoreCase="false" negate="true" />
      </conditions>
      <action type="Rewrite" url="index.php?it={R:1}" appendQueryString="true" />
    </rule>
    <rule name="Imported Rule 6" stopProcessing="true">
      <match url="^(.*)$" ignoreCase="false" />
      <action type="Rewrite" url="/index.php?it={R:1}" appendQueryString="true" />
    </rule>
  </rules>
</rewrite>

a

Link to comment
Share on other sites

This rewrite should work for IIS

<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="CLEAN URLS" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <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?it={R:1}" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>
  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...