I know that the topic "How to force HTTPS + WWW" is often discussed and resolved, and in general it works for me.
But since I now have a specific predefined .htaccess from CakePHP, I donโt know how to enable it.
.htaccess for CakePHP:
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
If I put the usual code for HTTPS / WWW Forcing at the beginning or in the opposite direction to this code, it does not work properly, because all requests are configured on the root directory, and not on, for example,. / Contact.
I usually use:
RewriteCond %{HTTPS} !on [OR] RewriteCond %{HTTP_HOST} !^www\.mydomain\.com$ [NC] RewriteRule ^ https://www.mydomain.com%{REQUEST_URI} [R=301]
But you cannot just include this above ...
Can someone please help me , including HTTPS / WWW Forcing in the above .htaccess?
source share