I’m not sure which index.php you are talking about. May you provide a full path to the file?
In future if you want to modify the way WordPress core functions it is recommended you create a plugin, theme, or child-theme and edit the files of one of those. It is recommended that you do not edit WordPress Core files as stated in the documentation. When WordPress updates it replaces old core files with new ones and any edits made to them may be lost.
It is also recommended that you create regular backups so that you can roll back in the event issues occur when there is an update.
Here is what I mean :
WordPress Address (URL) : https://mysite.com
ite Address (URL) : https://mysite.com/v2
Server File path : httpdocs/
Website version 2 : httpdocs/v2/
httpdocs/index.php is edited to point the website to /v2/
after auto update wordpress 5.4.1 my edited index.php file was re-created with a default index.php which points wordpress site to httpdocs/
hope is it clear ?
I never had this situation, when I update a WordPress in a subdirectory like /v2/ it doesn’t erase any file in root httpdocs
Alright, I understand now. Your edited root index.php has been replaced by the updated version. You may have avoided this issue for a long time because WordPress updates were only replacing files with changes and the root index.php doesn’t frequently receive changes.
There are other ways to rewrite/redirect the site to the subdirectory. I cannot immediately give detailed advice on how as I’d need to research but it can be achieved with an “.htaccess” file. WordPress does not replace the “.htaccess” file so your changes should be safe.
Ok thanks I will check
It is new for me since many years but OK I will pay attention to that now
Kind regards