I have the following problem. I want multiple htaccess rewriterules to result in only one 301 redirect.
Target URL: https://www.example.com/bar
My current situation is the following redirect chain:
301 -> https://www.example.com/Foo
301 -> https://www.example.com/foo
301 -> https://www.example.com/bar
# Rewrite unsecure connections to https connections
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://www.example.com%{REQUEST_URI} [R=301,L,NC,NE]
# Rewrite connections without subdomain to www subdomain
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule ^(.*)$ https://www.example.com%{REQUEST_URI} [R=301,L,NC,NE]
# Enforce lowercase on urls
RewriteCond %{REQUEST_URI} [A-Z]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ %{ENV:REWRITEBASE}${lc:$1} [L,R=301]
RewriteRule ^foo$ %{ENV:REWRITEBASE}bar [L,R=301,QSA]
What do I need to change?