I have in the .htaccess file a redirect of all requests for the https protocol

RewriteCond %{HTTPS} !on RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 

But you need to exclude from this rule one folder for example /my_dir

How to do it?

    1 answer 1

    Already found the answer:

     RewriteCond %{HTTPS} !on RewriteCond %{REQUEST_URI} !^.*/my_dir/.*$ RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 
    • And does it work - RewriteRule !/my_dir/ https://%{HTTP_HOST}%{REQUEST_URI} (only with one RewriteCond %{HTTPS} !on )? - Wiktor Stribiżew
    • one
      @ WiktorStribiżew unfortunately does not work. I first tried something similar, only RewriteRule /([^my_dir])/ https://%{HTTP_HOST}%{REQUEST_URI} but this rule completely disabled the redirect to https - stckvrw