I have a subdomain hosted on windows server developed by cakephp2.7 installed SSL on server, it is working if explicitly type https but do not automatically converts http to https I want to automatically convert any url to https
tried many things with .htaccess file but none work current htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
also tried
public $components = array('Security');
public function beforeFilter() {
$this->Security->blackHoleCallback = 'forceSSL';
$this->Security->requireSecure();
}
// Add this function in your AppController
public function forceSSL() {
return $this->redirect('https://' . env('SERVER_NAME') . $this->here);
}
with this code even any link click was not working.
this is for other if stuck in the same issue I resolved my issue to force redirect to https by adding the following code in
beforeFilter()method of `AppController' class