Using PURLs on IIS server

Purlem works with Linux servers out-of-the-box.  However, it is possible to get the PURLs working on a Windows IIS server if necessary.

  1. Copy the .htaccess file content found in Step 3 of your campaign's install instructions.

  2. Import the copied .htaccess file content into IIS's URL Rewrite Module. This essentially turns the .htaccess file (used by Linux servers) into a Microsoft syntax and places it in the site’s web.config file. 

The resulting code in the web.config file will look something like this:

<rewrite>
<rules>
<rule name="Purlem Rule 1" stopProcessing="true">
<match url="^([A-Za-z0-9_-]+)\.([A-Za-z0-9_-]+)/?$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{SCRIPT_FILENAME}" pattern="([A-Za-z0-9_-]+)\.(html?|php|asp|css|jpg|gif|shtml|htm|xhtml|txt|ico|xml)/?$" negate="true" />
<add input="{SCRIPT_FILENAME}" pattern="([A-Za-z0-9_-]+)\.([A-Za-z0-9_-]+)/?$" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Redirect" url="http://purldemo.com/purl-test?purl={R:1}{R:2}&amp;ID=1234&amp;page=1" appendQueryString="false" redirectType="Found" />
</rule>
</rewrite&

Note, if you're using Wordpress - The import tool places the rule set at the bottom, but for it to work, it needs to be moved up above any Wordpress rules.