add_rewrite_rule image from /images/site2/favicon.ico to /favico.ico

But I want change url to, How setting this url with rewrite rules in PHP.

You can’t. That’s not how WordPress rewrite rules work.

add_rewrite_rule is used for mapping pretty permalinks into the form /index.php?queryvar=value&etcetc.

Most servers don’t even load WordPress to handle requests like that for assets and skip PHP/WordPress completely for performance reasons. Doing this will require Nginx/Apache level changes above/outside of WordPress