title: cakephp and https redirects
body: <p>I have a site that has some strict requirements for SEO purposes.</p>
  
  <p>The main one is redirecting all http requests to https which I have done by adding this into the AppController:</p>
  
  <pre><code>public function forceSSL() {
      return $this-&gt;redirect('https://' . env('SERVER_NAME') . $this-&gt;here);
  }
  
  public function beforeFilter() {
      $this-&gt;Security-&gt;blackHoleCallback = 'forceSSL';
      $this-&gt;Security-&gt;requireSecure();
  }
  </code></pre>
  
  <p>The issue I have is with 404 pages, they do not redirect to https (eg. www.hublink.net/asdfg)</p>
  
  <p>I have also added these 2 lines to the .htaccess file (from another post), and removed the above code but then get a "redirect loop" error</p>
  
  <pre><code>RewriteCond %{HTTPS} !=on [NC]
  RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
  </code></pre>