How to redirect attachment URLs to the media itself

As of Yoast SEO 20.0, the settings interface inside our plugins has received a major overhaul. Please update to the latest version of Yoast SEO if your plugin does not look like the screenshots you encounter in our Help center.

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. Disabling media pages will cause all attachment URLs to redirect to the media itself. Follow the steps below to disable media pages with Yoast SEO.

  1. Log in to your WordPress website.

    When you’re logged in, you will be in your ‘Dashboard’.

  2. Click on ‘Yoast SEO’.

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

  3. Click on ‘Settings’.

    The ‘Yoast SEO’ settings will expand providing you with additional options. Click on ‘Settings’.
    Screenshot of the settings menu item in Yoast SEO

  4. Click ‘Advanced’, then ‘Media pages’.

    Click ‘Advanced’ in the settings menu on the left. Then, click ‘Media pages’.
    Screenshot showing the media pages settings in Yoast SEO

  5. Toggle the ‘Enable media pages’ switch off.

    We recommend disabling media pages. Yoast SEO will then redirect the attachment URLs to the media itself. By clicking the switch you can enable or disable the feature. If media pages are disabled, the toggle will show an X. If media pages are enabled, the toggle will show a checkmark.Screenshot showing the toggle that lets you disable or enable media pages in Yoast SEO

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.

Related articles

Get free SEO tips!