Index: src/doc.c
===================================================================
--- src/doc.c
+++ src/doc.c
@@ -308,10 +308,14 @@
     }
   }
   return "application/x-fossil-artifact";
 }
 
+static void doc_index_redirect(void){
+    db_end_transaction(0);
+    cgi_redirectf("%s%s", g.zBaseURL, "/doc/tip/index.wiki");
+}
 /*
 ** WEBPAGE: doc
 ** URL: /doc?name=BASELINE/PATH
 ** URL: /doc/BASELINE/PATH
 **
@@ -335,13 +339,16 @@
   char zBaseline[UUID_SIZE+1];      /* Baseline UUID */
   char * reason = "document not present in the repository";
 
   login_check_credentials();
   if( !g.okRead ){ login_needed(); return; }
-  zName = PD("name", "tip/index.wiki");
+  zName = P("name");
+  if( !zName) { return doc_index_redirect(); }
   for(i=0; zName[i] && zName[i]!='/'; i++){}
+  if( ! *zName) { return doc_index_redirect(); }
   if( zName[i]==0 || i>UUID_SIZE ){
+    reason = "invalid document specified";
     goto doc_not_found;
   }
   memcpy(zBaseline, zName, i);
   zBaseline[i] = 0;
   zName += i;

