We have some printed material with a QR code. The code was supposed to go to a landing page so we could keep track of how many times a PDF file was downloaded and by who, but somewhere along the line it was changed to point to the direct URL for the PDF.
The books are printed, so it's too late to fix that error.
What I would like to do is change the name of the PDF to something else, then create a rewrite rule in IIS that will listen for the URL that is in the QR code and redirect to the original landing page.
Apparently I'm doing something wrong.
<rule name="Training Packet download" stopProcessing="true">
<match url="^pdf/Mini%20Packet-takeaways-Parts.pdf$" />
<action type="Rewrite" url="pdf/seminarlanding.php" />
</rule>
It keeps going to the 404 error page, even though this rule is at the top of the list.
Tried it with exact match, and with redirect:
<rule name="Training Packet download" patternSyntax="ExactMatch" stopProcessing="true">
<match url="pdf/Mini%20Packet-takeaways-Parts.pdf" />
<action type="Redirect" url="pdf/seminarlanding.php" />
</rule>
That still goes to 404. I have a different rewrite rule that does work, and I'm not sure what the difference is.
<rule name="ViewPost Rewrite" stopProcessing="true">
<match url="^Community/Forum/([^/]+)/([^/]+)/?([^/]+)?$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="Community/Forum/ViewPost.php?f={R:1}&t={R:2}" />
</rule>
Tried to make them match even more closely, still 404:
<rule name="Training Packet download" stopProcessing="true">
<match url="^pdf/Mini%20Packet-takeaways-Parts.pdf$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="pdf/seminarlanding.php" />
</rule>