3

Our current setup redirects to a specific page if the requested file is pdf,xls,etc

Now we want to add an exception to the rule to exclude files prepended with some specific text such as "FSP_"

But my exceptions are not working. It works if I allow it to redirect if the text is present, but not when I negate it

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} ^.*(pdf|doc|xlsx|docx|xls)$
RewriteCond %{REQUEST_URI} !^/FSP_
RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC]
RewriteRule (.*) https://www.example.com/permissions/

If I remove the ! then it does the opposite of what I want - It redirects anything with the prefix

Any help would be greatly appreciated.

I have reviewed several references on the issue but still unable to get this working

htaccess redirect if url doesn't contain some string

htaccess RewriteCond REQUEST_URI detection not working

RewriteCond REQUEST_URI - ^ doesn't work as expected

Looked up the Apache pages as well but still not closer.

Kemystery
  • 31
  • 3

0 Answers0