I have the following Apache virtual host which redirects all traffic to the secure version of the site:
<VirtualHost *:80>
DocumentRoot "C:/Web/"
ServerName site.local
ErrorLog "C:/Webserv/Apache2.2/logs/site_error.log"
CustomLog "C:/Webserv/Apache2.2/logs/site_access.log" combinedvh
Redirect / https://site.local/
</VirtualHost>
I would now like to exclude certain directories from the redirect.
I tried
<DirectoryMatch "!^C:/Web/myfolder/">
Redirect / https://site.local/
</DirectoryMatch>
but then nothing is redirected to secure.
Is there an easy way to do this?
I do not want to end up with separate Redirect directives for every subfolder, especially since I want to redirect the root folder too.
Maybe you should use mod_rewrite, something like this: