Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Best way to force https
  • I'd like to implemente a base controller for secure access such that it will redirect any requests made which are not https to https enabled subdomain of my site.


    I was just going to use the Uri helper to inspect the domain and then do a redirect, but just thought I'd see if anyone has a better way.
  • I guess what I'd actually like to do is set the base url such that assets and things are also loaded in securely.
  • If you're entire site has to be https, the best way to handle it is to use a rewrite rule in your servers virtual host.

    If it's only a couple of pages, then you have to check for it manually (for example in a before method), using Input::protocol() to check if a secure page was requested or not, or upgrade to 1.6/develop, which supports protocol based routing as part of verb based routing (but that requires you to define routes).

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion