Mecha CMS

Code snippet collection for developers.

Force HTTPS

Redirect from HTTP to HTTPS.

// Redirect from `http://example.com` to `https://example.com`
if ($url->scheme === 'http') {
    Guardian::kick('https://' . explode('://', $url->current)[1] . $url->query);
}