I’m trying to redirect all requests for /library/ to an external URL except when .pdf files are requested. e.g. http://www.mysite.com/library/section should redrect to http://www.externalsite.com but http://www.mysite.com/library/docs/some_pdf.pdf should serve up the PDF file without a redirect. Here’s what I have:
RedirectMatch permanent /library/!(.*\.pdf) http://www.externalsite.com/
Try this: