I'm stumped on how to achieve this. The 1-1 redirects work fine as well as the global redirect to send anything to the new page that isn't contained in the code. But when trying to exclude one (or multiple) files/directories it will always redirect to
I ran this through an htaccess checker and when testing against
https://test.com/documents/test.pdf it ends right at the exclude statement but on the actual server it does not.
https://example.com/documents/test.pdf should not be redirecting, but it does, and it ends up redirecting to
RewriteEngine on # Exclude files / directories from redirects RewriteRule ^(documents)($|/) - [L] # Redirect specific files / pages to new locations RedirectMatch 301 /page1.html https://example.com/new-page1.html RedirectMatch 301 /dir1/page1.html https://example.com/random-new-page.html RedirectMatch 301 /documents/awesome.pdf https://example.com/new-webpage-to-replacepdf.html # Redirect anything else that isn't above to the homepage RedirectMatch 301 / https://example.com/homepage