I'm trying to clean up some URLs to a bunch of PDF files. Right now, you access a PDF by visiting the following:
http://www.mywebsite.com/sites/default/files/reports/2010_Audit_Summary_Report.pdf
But I want to clean this up by being able to access the same files using this URL:
http://www.mywebsite.com/reports/2010_Audit_Summary_Report.pdf
I thought that I might be able to do the following:
<rule name="MySpecialRule" stopProcessing="true">
<match url="/sites/default/files/reports/2010_Audit_Summary_Report.pdf" />
<action type="Rewrite" url="/reports/2010_Audit_Summary_Report.pdf" />
</rule>
But this is not working. Of course, the sample rule above would only work for one PDF, where I want this to work for all PDFs within the same directory.
Is this possible?
To match more than one specific URL, you need to use a regular expression and then reference the found string in the action:
Here I assume your filename consists only of letters, digits and underscores. I haven't tested this, but it should give you the idea how to solve this.