Skip to content

Instantly share code, notes, and snippets.

@woutersf
Last active May 12, 2020 12:30
Show Gist options
  • Save woutersf/57a3436642276b247ec9c3b675d89eaa to your computer and use it in GitHub Desktop.
Save woutersf/57a3436642276b247ec9c3b675d89eaa to your computer and use it in GitHub Desktop.
Drupal 8 test if on https page
<?php
// Drupal 7
global $is_https;
if ($is_https) {
// Do something
}
// Drupal 8
if (Drupal::request()->isSecure()) {
// Do something
}
// Don't you ever
@$_SERVER['HTTPS'] != 'on'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment