Site icon Hip-Hop Website Design and Development

How To Allow Only Specific User Agent To Access an Url?

Suppose this is my url: https://www.mrskt.com/sitemap_index.xml

I want to only specific user Agent, I mean only search bots like Google, Bing, Ahrefs, etc Can access that url.

And no other user Agent can access that url.

My website is on WordPress, how i can do that?