Reputation: 1848
I have redesigned a site from static html pages to Sitecore (8.0). I am setting up Url Rewrite maps in IIS. Rewrite maps that map from what was a PDF on the old site to a media item on the new site do not seem to be working. Here is an example map:
<add key="/PDF/ARandomPdfName.pdf" value="/~/media/Files/TopLevelFolder/SubFolder/ARandomPdfName.ashx" />
If I browse to the key I get a 404. If I browse to the value, I see the PDF. Do I need to do something special for media file redirects?
Upvotes: 0
Views: 1433
Reputation: 1848
This problem I dont think had anything to do with Sitecore. In the rewrite maps, IIS does not seem to want encoded spaces.
Old way that did not work:
<add key="/PDF/Clinical%20Preventive%20Care%20Brief%20-%20Adult-%20FINAL.pdf" value="/~/media/Files/Providers/medical-care-briefs/clinical-preventive-services-brief/clinical-preventive-care-brief---adult--final.ashx" />
So, I removed the encoded spaces (%20) to end up with:
<add key="/PDF/Clinical Preventive Care Brief - Adult- FINAL.pdf" value="/~/media/Files/Providers/medical-care-briefs/clinical-preventive-services-brief/clinical-preventive-care-brief---adult--final.ashx" />
And this works. If I browse to:
http://myhostname.com/PDF/Clinical%20Preventive%20Care%20Brief%20-%20Adult-%20FINAL.pdf
I get redirected correctly.
Upvotes: 1