--- a/securepages.module
+++ b/securepages.module
@@ -12,10 +12,10 @@ function securepages_boot() {
   $path = isset($_GET['q']) ? $_GET['q'] : '';
   if ($path == 'admin/build/securepages/test') {
     if (securepages_is_secure()) {
-      header('HTTP/1.1 200 OK');
+      drupal_set_header($_SERVER['SERVER_PROTOCOL'] . ' 200 OK');
     }
     else {
-      header('HTTP/1.1 404 Not Found');
+      drupal_set_header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
     }
     exit();
   }
@@ -189,7 +189,8 @@ function securepages_goto($secure) {
   else {
     bootstrap_invoke_all('exit');
   }
-  header('Location: '. $url);
+  drupal_set_header($_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently');
+  drupal_set_header('Location: '. $url);
 
   // Make sure the cache is clear so that the next page will not pick up a cached version.
   cache_clear_all($base_root . request_uri(), 'cache_page');
