You can find our user documentation at docs.cpanel.net.

Check out our new API beta site!

Child pages
  • UAPI Functions - DirectoryIndexes::set_indexing
Skip to end of metadata
Go to start of metadata

Description

This function configures the directory indexing settings for a directory on the cPanel account.

Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/DirectoryIndexes/set_indexing?dir=2Fhome%2Fexample%2Fexample.com&type=inherit


Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Enable directory indexing for the /home/example/example.com directory.
$set_indexing = $cpanel->uapi(
    'DirectoryIndexes', 'set_indexing',
    array(
        'dir'     => '/home/example/example.com',
		'type' 	  => 'inherit'
  	)
);


Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Enable directory indexing for the /home/example/example.com directory.
my $set_indexing = $cpliveapi->uapi(
    'DirectoryIndexes', 'set_indexing',
    {
        'dir'      => '/home/example/example.com',
		'type'     => 'inherit',
    }
);


Note:

For more information, read our Guide to the LiveAPI System.

 

 Command Line
uapi --user=username DirectoryIndexes set_indexing dir=2Fhome%2Fexample%2Fexample.com type=inherit


Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 Output (JSON)
{
	"errors": null,
	"data": "inherit",
	"warnings": null,
	"status": 1,
	"messages": null,
	"metadata": {}
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
dirstring

Required

The directory for which to manage directory indexing.

A valid directory path on the cPanel account./home/example/example.com
type string

Required

The type of directory indexing.

  • standard — Enable directory indexing system's default settings.
  • disabled — Disable directory indexing.
  • inherit — Enable directory indexing with the system's default settings.
  • fancy — Enable directory indexing with the Apache® FancyIndexing directive. The directory will include additional information such as file size and the date of the file's last update.
inherit 

Returns

ReturnTypeDescriptionPossible valuesExample
data stringThe directory's indexing type.
  • standard — The directory uses directory indexing with standard formatting.
  • disabled — The directory doesn't use directory indexing.
  • inherit — The directory uses the system's default settings.
  • fancy —  The directory uses directory indexing with Apache® FancyIndexing directive. The directory will include additional information such as file size and the date of the file's last update.
disabled