The Problem

Accessing my site over https (the only protocol allowed) I get the content, but none of the CSS, images etc.

Drupal is creating pages in response to https requests that include http links to these resources, but it should be using https.

What I've done

I have copied a site to a dev server. The site loads and basically works fine - I can log in etc. It's just that all the links drupal generates are http. The site I've copied it from also runs over https. The site does not exist on http (it would just get a Forbidden error). I've drush cc all.

So Apache's working - I can access the site. .htaccess is working (clean urls work, for example).

I'm using SNI to access the site because the server has other vhosts too, but I'm only accessing the site using the latest Firefox (and as it's a dev site and I'm the only dev, nobody else will use it).

I've done this dozens of times and am quite stumped! Why does Drupal not notice that the request came over https?

The fix

Turns out that .htaccess has this to say:

/* Base URL (optional).                                                        

If Drupal is generating incorrect URLs on your site, which could            
be in HTML headers (links to CSS and JS files) or visible links on pages    
(such as in menus), uncomment the Base URL statement below (remove the      
leading hash sign) and fill in the absolute URL to your Drupal installation.

Sure enough, putting $base_url = 'https://example.com'; fixed it.

But why is this necessary?

  • Was drupal generating fully qualified urls starting with http:// ?
    – jonhattan
    Commented Jun 21, 2014 at 10:30
  • @jonhattan yes it was. Commented Jun 21, 2014 at 11:55
  • I've been having the exact same issue, yet my .htaccess file does not have the statement you posted in it. I re-downloaded Drupal 7 and coppied the .htaccess from there, and it also does not have this statement. What can I do? How can I make this work? Commented Dec 4, 2014 at 18:58
  • Could you provide what version of Drupal you are using and what version you .htaccess file came from if it is different. Commented Dec 4, 2014 at 20:12

1 Answer 1


I had a similar problem and ended up using $base_url = ''. It fixes the problem with static content. Drupal will generate relative URLs instead of absolute which is the right thing to do anyway. However, this breaks update.php for some reasons (running 7.38).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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