What is an attachment page?
An attachment page is the web page WordPress generates for each uploaded image, PDF, audio or video file. WordPress stores every upload as a post of type attachment, and on sites where attachment pages are enabled each of those posts gets its own URL, rendered with the theme's attachment or single-post template.
Because the page usually holds one image and a title, search engines see it as a near-empty page. A site with a large media library can have more attachment pages than articles, which is why they are a common source of thin content and index bloat on older WordPress sites.
Where they live
The address depends on whether the file was uploaded while editing a post:
| Upload | Typical attachment page URL |
|---|---|
| Uploaded to a post | /post-slug/file-slug/ |
| Uploaded straight to the Media Library | /file-slug/ |
| Any upload, any permalink setting | /?attachment_id=123 |
The post a file was uploaded to is its parent, shown in the Uploaded to column of the Media Library's list view. WordPress sets it once; inserting the image into other posts later does not change it.
The WordPress 6.4 change
WordPress 6.4 added the wp_attachment_pages_enabled option and set it to off for new installs. With it off, a request for an attachment page is redirected to the file itself. Sites installed before 6.4 keep the option on after upgrading, so they still serve attachment pages until someone changes it.
To see which applies to a site, open an image in Media → Library and follow View attachment page. A themed page means they are on; the bare file means they are off.
What to do with them
There are three choices:
- Keep them, when the theme gives each page real content, such as a photography gallery with captions and navigation.
- Redirect to the file, the WordPress 6.4 default. Simple, and right for downloads such as PDFs, but a visitor who clicks a search result lands on a bare file.
- Redirect to the parent post, so the visitor sees the image inside the article it belongs to, with a fallback to the file when the parent is not published or not public.
Whichever you choose, use a 301 so links to the old pages count toward the destination, and never send them all to the home page, which search engines tend to treat as a soft 404.
In WordPress
Hydrogen SEO 0.0.28 added Redirect Attachment Pages under General → Permalinks, off by default. Switched on, each attachment page redirects (301) to the published, public, non-password-protected post its file was uploaded to, and to the file otherwise. Images inside posts are untouched, and manual rules in the Redirection Manager take priority. See attachment page redirects and the step-by-step guide to redirecting attachment pages.
Common questions
Do attachment pages hurt SEO?
They rarely help. Most hold one image and a title, so they add thin pages to the index and give visitors little reason to stay. Redirecting them removes the pages without affecting the images in your posts.
Will redirecting attachment pages remove my images from Google Images?
No. The redirect applies to the HTML page WordPress builds for the file. The image file keeps its own URL, and so do the posts that display it.
Is an attachment page the same as the image URL?
No. The image URL, such as /wp-content/uploads/2024/05/photo.jpg, is the file. The attachment page is a separate HTML page that displays the file inside the theme.