I have a problem with mod_rewrite configuration. I have a website, where I need to push every request through index.php. I also would like to have redirect from http to https on every website, with one exception (folder /free). It sounds like trivial task, but I still have problems. My .htaccess configuration:
<IfModule mod_rewrite.c>
SetEnv CAKEPHP_DEBUG 1
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^/free$ [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/free$ [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_URI} !^/(img|css|js|shared)/(.*)
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
It works well, except /free path. when https://test/free is called, there is a forward to http. After http call, redirect to https://website/index.php is returned. This is wrong - I would like to stay in http /free folder. How can I do this forward correctly? If I comment out forward from http to https, everything works well. Any ideas?
Edit: proposal from duplicated link did not work. The problem was duplicate processing by index.php rewrite - great answer with "end" flag resolved my issue