diff --git a/includes/unl_bootstrap.inc b/includes/unl_bootstrap.inc
index d8f3b15f4fec2f02463a4698a2dac1648d67bf2c..a053542c6237898f5624a057d70d2ba698050d87 100644
--- a/includes/unl_bootstrap.inc
+++ b/includes/unl_bootstrap.inc
@@ -15,6 +15,11 @@ function unl_bootstrap() {
  * If it doesn't redirect to <hostname>.unl.edu.
  */
 function unl_bootstrap_short_hostname_redirect() {
+  // Don't do a redirect when using the command line.
+  if (PHP_SAPI == 'cli') {
+    return;
+  }
+  
   $hostname = $_SERVER['HTTP_HOST'];
   if (gethostbynamel($hostname)) {
     // The provided host name is just fine.