I have several pages that need to be protected through mod_rewrite, and the code is based on the mvc architecture
Let me say that I have a login page, its URL is http://www.example.com/login , it needs to be redirected to https://www.example.com/login
If any url other than the desired secure URL uses https, we need to change it to http for example
https://www.example.com/sitemap must be redirected to http://www.example.com/sitemap
I am using the following code in .htaccess
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^login$ https://%{HTTP_HOST}/login [R=301,L]
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{REQUEST_URI} !^/login$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
The problem I am getting is looping where it says: "The server redirects the request to this address in a way that will never be completed."
, URL- , . .htaccess, symfony.
https://www.example.com/login
https://www.example.com/account
https://www.example.com/register