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

Question

But I want change url to https://cdn.domain.com/favicon.ico, 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

0
Muhammad Hasan Bahtiar 6 days 2023-03-17T13:13:31-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse