directoryindex with the /go/directoryindex Command

When a visitor opens a folder URL such as https://example.com/, the web server looks for an index file to show. /go/directoryindex sets the list of file names it looks for, and the order. The first file in the list that exists is served. The command: Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

# Show the current Apache value
/go/directoryindex return

# Set the list (order matters)
/go/directoryindex index.php index.html

# Reset to the GoAdmio default list
/go/directoryindex

Arguments

Argument Required Notes
return No Prints the current Apache value and changes nothing. Not case-sensitive.
<file> ... No One or more index file names, separated by spaces. The first existing file wins. Use plain file names only.
default No Sets default.html index.html index.php go.html.
(none) No Sets default.html index.html index.htm index.php go.html.
--noreload No Intended to skip the reload, but it has no effect. The web server is always reloaded.

If the first argument starts with --, it is ignored and the full default list is set.

Write file names only, such as index.php. Characters such as /, &, and \ break the edit.

[!NOTE]
The command writes all of its arguments into the configuration. Don’t add --noreload after the file names, or it ends up in the list as a file name.

Examples

# PHP sites first, then static pages
/go/directoryindex index.php index.html index.htm

# Reset to the defaults
/go/directoryindex

# Check the Apache setting (AlmaLinux, Rocky, CentOS, Red Hat, Fedora)
grep -n '^[[:space:]]*DirectoryIndex' /etc/httpd/conf/httpd.conf

# Check the Apache setting (Debian, Ubuntu)
grep -n '^[[:space:]]*DirectoryIndex' /etc/apache2/mods-enabled/dir.conf

# Check the Nginx setting
grep -n '^[[:space:]]*index' /etc/nginx/nginx.conf

# Validate the configuration after a change
/go/checkapache
/go/checknginx

Output

When setting a value, the command prints nothing of its own. Any output comes from reload.

With return, it prints the Apache value, for example:

default.html index.html index.htm index.php go.html

It then exits with status 1, even though nothing went wrong.

Message Meaning
Unknown operating system. The OS is not AlmaLinux, Rocky, CentOS, Red Hat, Fedora, Debian, or Ubuntu. Nothing is changed.

See the full reference at /go/directoryindex and the GoAdmio command index.

GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *