Rewrite Rule added but showing 404 rather than specified page

Well this is silly but I figured it out. I removed the last / from the pattern and now it works as expected. Code is now…

add_rewrite_rule('^coaching/apply', 'index.php?page_id=5156', 'top');

Seems weird to me that ^coaching/apply would work but not ^coaching/apply/ esp when entering example.com/coaching/apply/ as the url works.

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