Jump to content

Recommended Posts

Posted

I needed all but one template on a site to render https. I had a lot of templates on the site in question so it was easiest to change them all to be https like this at the very top of head.inc:

foreach ($templates as $template) {
    $template->https = 1;
    $template->save();
}

Then I loaded a page on the site once, removed the code and changed the one template I DIDN'T want to be https to force http instead (of course you could add a check in the code above for that template, but it was as quick either way!).

It was a rare occasion where a site had about 25 templates and I needed to first make this change on dev, then live, so this was far quicker than ticking them all apart from one to https manually.

Hope it's of use to someone.

The value for forcing non-https is -1 and the default (allow both) is 0 by the way.

  • Like 6

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...