The tolerant base URL
Drupal.org - a little trick I found that will allow me to support both http and https. It also stops Drupal from rewriting www.billstclair.com, or billstclair.nfshost.com, to billstclair.com. The details are only interesting for Drupal site administrators...
In your settings.php
file, instead of a fixed string for the $base_url
, use the following (three dots denote elided code):
<?php
...
$base_url = 'http' . (isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] == 'on' ? 's' : '' : '');
$base_url .= '://' .$_SERVER['HTTP_HOST'];
if ($dir = trim(dirname($_SERVER['SCRIPT_NAME']), '\,/')) {
$base_url .= "/$dir";
}
...
?>
Previous Posts:
Logs disabled; The future of billstclair.com
Take a leap into hyperspace
How the Grinch Stole Nanotech and More
Quote
Bush Crosses the Rubicon
The AeroPress Coffee Machine
Hardyville Courts Prosperity (Reluctantly)
The courts, parents, kids and guns
I'm a White-Collar Redneck: And Proud of It
Fool Me Twice