Cobra Forum

Plesk Panel => Webserver => Topic started by: Suhitha on Dec 21, 2025, 11:47 PM

Title: How to change the default index for all websites on Plesk?
Post by: Suhitha on Dec 21, 2025, 11:47 PM
Applicable to:



Question

How to change or reorder default index files (DirectoryIndex) for all websites on the server?


Answer

For Linux

                              Click here to reveal additional information

Note: In the following example, index.php is set as a priority. All newly created domains will have the new directoryIndex afterwards.

1.Connect to the server via SSH;

2.Add the following lines to /usr/local/psa/admin/conf/panel.ini using any text editor:

[webserver]
directoryIndex = "index.php index.html index.cgi index.pl index.xhtml index.htm index.shtml"

3.Reconfigure all existing domains:

# plesk bin domain -l | while read i; do plesk repair web $i -y; done

For Windows

                                  Click here to reveal additional information

Note: In the following example test.php file is set as a priority:

1.Connect to the server via RDP.

2.Open PowerShell command line

3.Run one of the following commands depending on the requirements:

Note: change the "test.php" file in the command below to the correct one.

ps > plesk bin site -l | % { if ( $_ ) { &$env:windir\system32\inetsrv\appcmd.exe set config $_ /section:defaultDocument /enabled:true /+files.[value=`'test.php`'] } }

If the following error appears:

ERROR ( message:New add object missing required attributes. Cannot add duplicate collection entry of type 'add' with unique key attribute 'value' set to 'main.php'. )
then such file is already present in the default documents list. Modify file priority manually in IIS > hostname > Sites > example.com > Default Documents.

(https://pix.cobrasoft.org/images/2025/12/22/mceclip4-1.png)

ps > plesk bin site -l | % { if ( $_ ) { &$env:windir\system32\inetsrv\appcmd.exe clear config $_ /section:defaultDocument } }