1. Josh Carrier
  2. phpHgAdmin
  3. Issues
Issue #19 open

The requested URL /hgadmin/admin/hgdir was not found on this server.

created an issue

I installed hgweb.cgi according to the instructions on the Mercurial website. It lives in /var/www/webhg.cgi and is accessible at, thanks to Apache magic. The hgweb.config file is in /var/hg/ and a repository group setup in /var/hg/repos.

When I access PhpHgAdmin's page, it comes up fine. When I try to add a new repository, I am redirected to an Apache "Not Found" error which states that could not be found.

The relevant parts of phpghadmin.php are pasted below:



$config['base_url'] = ""; $config['profile']['default']['ini'] = '/var/hg/hgweb.config'; $config['profile']['default']['default_repo_dir'] = '/var/hg/repos/'; $config['profile']['default']['hgserve_url'] = ''; $config['profile']['default']['default_hgrc'] = $config['default_hgrc']['general']; }}}

Comments (6)

  1. Josh Carrier repo owner
    • changed status to open

    You'll need to make sure there's a bit more Apache magic going on:

    1. Going to lands you at the phpHgAdmin front end. This is probably the .htaccess for the root / directory.

    2. That the .htaccess in your /hgadmin folder (where phpHgAdmin is based out of) has the proper folder structure and redirects set up.

  2. Anonymous

    You need to add a Directory element with an AllowOverride line. e.g.: <Directory /path/to/htdocs/hgadmin/admin> AllowOverride All </Directory>

    (fwiw, I couldn't find this mentioned anywhere on the hgadmin install instructions)

  3. William Roush

    I manually added hgwebdir.cgi (you can find the file contents online typically) to /hg and then installed phphgadmin into my web's root directory (so you can access it at /admin).

    For those of you that want easy-modo:

    #!/usr/bin/env python
    # An example CGI script to export multiple hgweb repos, edit as necessary
    # adjust python path if not a system-wide install:
    #import sys
    #sys.path.insert(0, "/path/to/python/lib")
    # enable importing on demand to reduce startup time
    from mercurial import demandimport; demandimport.enable()
    # Uncomment to send python tracebacks to the browser if an error occurs:
    #import cgitb
    # If you'd like to serve pages with UTF-8 instead of your default
    # locale charset, you can do so by uncommenting the following lines.
    # Note that this will cause your .hgrc files to be interpreted in
    # UTF-8 and all your repo files to be displayed using UTF-8.
    #import os
    #os.environ["HGENCODING"] = "UTF-8"
    from mercurial.hgweb.hgwebdir_mod import hgwebdir
    import mercurial.hgweb.wsgicgi as wsgicgi
    # The config file looks like this.  You can have paths to individual
    # repos, collections of repos in a directory tree, or both.
    # [paths]
    # virtual/path = /real/path
    # virtual/path = /real/path
    # [collections]
    # /prefix/to/strip/off = /root/of/tree/full/of/repos
    # collections example: say directory tree /foo contains repos /foo/bar,
    # /foo/quux/baz.  Give this config section:
    #   [collections]
    #   /foo = /foo
    # Then repos will list as bar and quux/baz.
    # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples
    # or use a dictionary with entries like 'virtual/path': '/real/path'
    application = hgwebdir('hgweb.config')

    Fixed my problem, but may need some tinkering depending on your setup.

  4. Log in to comment