Hello again,
I finally solved the problem.
The problem appeared when I made the configuration to migrate to https making the changes in the htaccess file and in wordpress wp-config, directly on the server without any plugin.
So, if you visited the media section, you could see that the url of all media appeared as http in their paths instead of https.
Thinking about it I decided to remove the configuration in the wp-config file and force the change from the worpress configuration, in General Options. I changed the wordpress url and the site url by typing https there and then the problem was solved.
It has been strange because previously, in the fields, the urls appeared correctly but nevertheless internally it did not work well.
Thank you for your comments