diff --git a/doc/man/man2html.py b/doc/man/man2html.py
index bfc20feff7736e7ea37e25ce07dabc55309e8f02..fe092c4d27f30f36677e2c07d831df323c2729b1 100755
--- a/doc/man/man2html.py
+++ b/doc/man/man2html.py
@@ -88,8 +88,12 @@ def llnl_references(line):
             return lineFix
         return line
 
-def relative_reference(lineIn):
-    fullRef = "http://localhost/cgi-bin/man/man2html"
+# NOTE: Different versions of man2html generated different paths
+def relative_reference(lineIn, mode):
+    if mode == 1:
+        fullRef = "http://localhost/cgi-bin/man/man2html"
+    else:
+        fullRef = "/cgi-bin/man/man2html"
     lenRef = len(fullRef)
     lineOt = ""
     cursor = 0
@@ -185,7 +189,8 @@ for filename in files:
         #insert tags for some options
         insert_tag(html, line)
         # Make man2html links relative ones
-        line = relative_reference(line)
+        line = relative_reference(line, 1)
+        line = relative_reference(line, 2)
 
         line = url_regex.sub(url_rewrite, line)
         html.write(line)