How Do I Redirect Image Attachment URLs?
Attachments to posts are stored in the database as posts, this means they're accessible under their own URLs if you do not redirect them, enabling this will redirect them to the post they were attached to.
If the attachment URL is not redirecting or redirects to the wrong URL, the image is likely not attached to a post or page. Learn how to attach an image to a post or page below.
- Log in to your WordPress website. When you're logged in, you will be in your 'Dashboard'. On the left-hand side, you will see a menu. In that menu, click on 'SEO'.
- The ‘SEO’ settings will expand providing you additional options. If you don't see the 'Advanced' setting in your 'SEO' menu, please enable your advanced settings first.
- Click on 'Advanced'.
- Click on the 'Permalinks' tab.
- Toggle the 'Redirect attachment URLs to parent post URL'. Redirect will automatically redirect the attachment URLs to the parent post. No redirect will leave the attachment URLs accessible.
Why Is It Not Working?
This only works when an image is attached to a post. You can attach images to posts in the media section.
- Log in to your WordPress website. When you're logged in, you will be in your 'Dashboard'. On the left-hand side, you will see a menu. In that menu, click on 'Media'.
- Switch to list view by clicking the list icon.
- Change 'All media items' to 'Unattached' and click 'Filter'.
- Hover your mouse over the first image. Click Attach and select post or page where you want this image's attachment URL to redirect. Repeat for all unattached images.
If an image is attached to the wrong page, you can click Detach when filtering for 'All media items' and attach to the correct page.