hgwebdir.cgi and clean URLs

Dave Dribin dave-ml at dribin.org
Wed May 21 14:57:38 UTC 2008


Hi,

Ever since I upgraded to 1.0 from 0.9.5, hgwebdir.cgi URLs include the  
"hgwebdir.cgi" in the URLs it generates.  I prefer the old behavior.   
I found this message in the archives with a possible solution:

   <http://marc.info/?l=mercurial&m=120457382705683&w=2>

Namely, add os.environ["SCRIPT_NAME"] = "" in your hgwebdir.cgi.   
However, that did not work for me.  This is what *did* work, so I'm  
posting for archival posterity (add to your hgwebdir.cgi):

# hide internal /hgwebdir URLs:
os.environ["SCRIPT_NAME"] = re.sub(r'/hgwebdir\.cgi$', '',  
os.environ["SCRIPT_NAME"])

The message in the archive assumed URLs like:

   http://hg.example.com/

where using this regexp works for URLs like:

   http://www.example.com/subdir/hg/

Perhaps something like this should be included in the standard  
hgwebdir.cgi script?

-Dave




More information about the Mercurial mailing list