Hi,
Infopro thank you for the hint. Neither the online scanner of Sucuri nor the sucuri wordpress plugin found any problem.
However, I managed to find that there was malware inside Wordpress Seo plugin (aka Yoast):
There was a folder named "vendor" and some subfolders that regularly don't exist, named "pimple", "psr", "ruskusing". Especially inside "ruskusing" folder there were PHP, C and even sqlite3 files. I've found it out while searching for hacking files with common names, like 1.php, according to this useful post: smashingmagazine . com /2012/10/four-malware-infections-wordpress.
So I searched for 1.php and I found 001.phpt inside the "pimple" folder and the hack began to unfold.
I cleaned up the database, which was severely infected. In the database where records pointing to external IPs.
Also bear in mind that if there is the "404 to 301" plugin installed, it makes it difficult to trace the redirects.
Furthermore, I uninstalled this plugin and some more, changed WP admin username and password, database name, database user and password, wordpress hashes in wp-config.php and runned new scans.
I don't know what was the exact cause of the problem, because my client hosted the infected website in another company till the end of November. Maybe some nulled plugin or something else, it's hard to tell.
In any case, the commands
webmasteryoda suggested were really helpful, because that way one can record the redirects and generated traffic to external domains.
Time will show if the website is fully cleaned or there are backdoors the hackers could use to strike again. Any further advice would be much appreciated.
Thank you,
George