How to change the default index for all websites on Plesk

Follow

Comments

8 comments

  • Avatar
    Faris Raouf

    This is really helpful. I'd like to make some suggestions please:

    For item 3, users who are not familiar with Event Handler may wonder which priority to use. Maybe it could be suggested that the default priority should be used.

    For item 4, again new users may be confused. I would assume only the root user would have the correct permissions to run the "subscription" command. But if there is a better user to select, maybe you could add an appropriate suggestion?

     

     

    0
    Comment actions Permalink
  • Avatar
    Artyom Baranov

    @Faris Hi!

    Thank you for the feedback. 

    > For item 3, users who are not familiar with Event Handler may wonder which priority to use. Maybe it could be suggested that the default priority should be used.

    Its hard to say for sure, how many handlers already exist and recommending to set the default (lowest) priority can lead to incorrect behavior.

    > For item 4, again new users may be confused. I would assume only the root user would have the correct permissions to run the "subscription" command

    I have updated the article according your recommendation. Thanks again :)

    0
    Comment actions Permalink
  • Avatar
    Steven Craig

    How do you do this for windows plesk?

    0
    Comment actions Permalink
  • Avatar
    Alexander Tsmokalyuk

    @Steven A solution for Windows was added

    -1
    Comment actions Permalink
  • Avatar
    Denis Bykov

    @Albert Stienen

    What exact error do you see?
    Please note that Powershell should be used and not the default Command Prompt.

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov (Edited )

    Hello @Albert,

    Thank you for paying our attention.
    The article was reworked.

    According to IIS documentation, there is no way to change the priority of existing file via command line. If it is necessary to change the priority of such a file, it should be configured manually in IIS > hostname > Sites > example.com > Default Documents.

    A new file can be added to the top of the list using the following script:
    plesk bin site -l | % { if ( $ ) { &$env:windir\system32\inetsrv\appcmd.exe set config $ /section:defaultDocument /enabled:true /+files.[value=`'test.php`'] } }

    0
    Comment actions Permalink
  • Avatar
    Wies Tange

    Hi,

    I tried the Linux solution but unfortunately it does not work on a new vhost.

    event: domain created
    priority: lowest 
    user: root
    command: /home/admin/index-order.sh

    I put this .sh file on the server itself on the same path.

    But a new domain still has the html index up front insrtead of the php.
    Is there a way to check in any logs if anything at all happened?
    TIA

     

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello @Wies,

    Sorry for the late response.

    I've tested the provided Linux solution for new domains and the solution worked fine for me.

    Please, make sure you've followed all the steps as described.

    The script location I used was /root/DefaultDoc.sh.

    Also, I've noticed you've used a non-standard script name was it modified manually?

    Generally, to make sure the script works as expected, start it manually after replacing "${NEW_DOMAIN_NAME}"  with a real domain name.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request