WordPress generates a URL for whatever file you post, including images. You can use a direct link or conduct a search to find this URL. Some people might prefer to block the attachment pages for different kinds of media, though.

This is due to the possibility that a visitor will click on one of those attachment sites and see only a single image with no accompanying text. This could give the impression that the page is unfinished and under construction, which would be extremely detrimental to your website’s SEO rankings.
I’ll walk you through the process of making WordPress disable those media attachment pages in this article. I’ll actually demonstrate the methods for doing this without using plugin.

Go to functions.php and add code as below:

function redirect_attachment(){

if(is_attachment()){

$attachment_ID = get_queried_object_id();

$file_url = wp_get_attachment_url($attachment_ID);

wp_redirect($file_url, 301);

exit();

}

}

add_action('template_redirect', 'redirect_attachment');