My Drupal site is using https:// but the base URL is not using it.

My site therefore is not opening properly. Is there any way to make Drupal pick up the correct base URL?

I tried adding $base_url in settings.php but it's giving me this error:

GET https://example.com/js/admin_menu/cache/6599fa6c7ea0ac232a88eaa63e957878 404 (Not Found)

  • Forgive me for asking obvious, have you cleared all caches? drush cc all? Dec 17, 2014 at 19:59

2 Answers 2


Try setting the $base_url on the protocol:

  $base_url = ((isset($_SERVER['HTTPS'])) ? 'https://' : 'http://') . 'www.yoururl.com';

You need same thing : How to get the base url?.

function _get_base_url(){
  $protocol = ($_SERVER['HTTPS'] && ($_SERVER['HTTPS'] != "off")) ? "https" : "http";
  return $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

Not the answer you're looking for? Browse other questions tagged or ask your own question.