我正在尝试将所有对/library/的请求重定向到一个外部URL,除非请求.pdf文件。例如www.mysite.com/library/section应该重定向到www.externalsite.com,但是www.mysite.com/library/docs/some_pdf.pdf应该提供没有重定向的PDF文件。这就是我所拥有的:
RedirectMatch permanent /library/!(.*\.pdf) http://www.externalsite.com/发布于 2009-04-16 13:58:49
试试这个:
RedirectMatch permanent /library/(?!.*\.pdf) http://www.externalsite.com/发布于 2009-04-16 15:58:14
您可能希望匹配整个路径,而不是子字符串:
RedirectMatch permanent ^/library/(?!.*\.pdf)$ ...https://stackoverflow.com/questions/756216
复制相似问题