Multisite permalink issue

So the problem was in the custom rest route which had the call to flush_rewrite_rules() which (as far as I can see) resetted the permalinks to default somehow and messed up the permalink structure.

Once we removed all the calls to the custom route no 404 happened.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)