My .htaccess file works fine for everything expect 1 specific folder. As result, http://www.mydomain.com/administration/index.php unexpectedly goes to 401 error page instead of loading index.php from administration folder.
So, for administration folder, I wish to:
1)always replace http with https for administration folder (for other folders, the last part of .htaccess works fine).
2) do not redirect urls, if they go to administration folder.
3) All rules after 1) and 2) are voided for administration folder.
I've tried to add 2) and 3) to .htaccess. So, now my .htaccess file looks like:
#adds www - always, for any url, for any folder
RewriteCond %{HTTP_HOST} !^www.mydomain.com$
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]
#special rules for administration folder only - set https if not https
RewriteCond %{REQUEST_URI} ^/administration
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R,L=301]
#all requests to administration folder should stop here
RewriteCond %{REQUEST_URI} ^/administration
RewriteRule ^ - [L]
#some rules below - not for administration folder
But, it goes to 401 error page if I type mydomain.com/administration/index.php anyway, although I wish it goes to https://www.mydomain.com/administration/index.php.
All the rest works perfect.
If I remove .htaccess, it goes directly to any of
http://www.mydomain.com/administration/index.php
https://www.mydomain.com/administration/index.php
with no problems.
Thank you in advance.