Thanks for the great suggestions. These helped me a lot.
But the code for redirecting to 'www' in settings.php trows an error when the site is handled by drush. Therefore I use it like this:
// Check if Drupal is not running via command line & add www
if (php_sapi_name() != "cli") {
if ($_SERVER['HTTP_HOST'] == 'mydomain.be') {
header('HTTP/1.0 301 Moved Permanently');
header('Location: //www.mydomain.be'. $_SERVER['REQUEST_URI']);
exit();
}
}
Hi Bram,
Thanks for the great suggestions. These helped me a lot.
But the code for redirecting to 'www' in settings.php trows an error when the site is handled by drush. Therefore I use it like this:
// Check if Drupal is not running via command line & add www
if (php_sapi_name() != "cli") {
if ($_SERVER['HTTP_HOST'] == 'mydomain.be') {
header('HTTP/1.0 301 Moved Permanently');
header('Location: //www.mydomain.be'. $_SERVER['REQUEST_URI']);
exit();
}
}