Image Attachment URLs

Let's say you upload an image called image.png. WordPress uses the permalink structure to create a URL of https://example.com/image/, for example. This page displays your theme header, sidebar, and footer with the embedded image.

In most cases, you or your developer have not customized this page so it has little to no SEO value due to its thin content. For that reason, we recommend redirecting the URL to the actual image.

How to redirect attachment URLs to the actual image using Yoast SEO

Attachments to posts are stored in the database as posts, this means they're accessible under their own URLs. Enabling the redirect image feature will redirect these URLs to the actual image.

  1. Log in to your WordPress website.

    When you're logged in, you will be in your 'Dashboard'.

  2. Click on 'SEO'.

    On the left-hand side, you will see a menu. In that menu, click on 'SEO'.

  3. Click on 'Search Appearance'.

    The ‘SEO’ settings will expand providing you additional options. Click on 'Search Appearance'.
    Admin SEO Search Appearance

  4. Click on the 'Media' tab. 

  5. Toggle the 'Redirect attachment URLs to the attachment itself?' switch.

    Toggle the switch to 'Yes' to automatically redirect the attachment URLs to the image itself.
    Toggle the switch to 'No' to leave the attachment URLs accessible.

Redirect attachment URLs to a post or page

Versions earlier than Yoast SEO 7.0 offered the option to redirect to a post or page. This method, however, was not always reliable and caused a lot of issues, especially when an image was added to multiple parts of your site. Therefore, the option was updated to redirect to the actual image.

Was this article helpful? ·