Redirect attachment urls to parent post url


#1

Yoast removed this nice feature a few months ago. Does anyone know how we can redirect attachment urls to parent post url?
Thank you!


#2

In the Yoast Version 9.2.1

That feature still exist at /wp-admin/admin.php?page=wpseo_titles#top#media

image


#3

Sorry I meant this one. We don’t have this feature anymore isn’t it?

Image taken from here: https://themeisle.com/blog/redirect-wordpress-attachment-pages/


#4

Yes, that feature has been replaced to Redirect attachment to image, if you still want there is a plugin for it.

Yoast says …

What do attachment URLs do anyway?

When you upload an image in WordPress, WordPress does not only store the image, it also creates a separate so-called attachment URL for every image. These attachment URLs are very “thin”: they have little to no content outside of the image. Because of that fact, they’re bad for SEO: they inflate the number of pages on your site while not increasing the amount of quality content. This is something that WordPress does, which our plugin takes care off (if the setting is correctly turned to “Yes”).

Historically, we had had a (default off ) setting that would redirect the attachment URL for an image to the post the image was attached to. So if I uploaded an image to this post, the attachment URL for that image would redirect to this post. In the old way of dealing with this, it meant that images added for other reasons (like say, a site icon, or a page header you’d add in the WordPress customizer), would not redirect. It also meant that if you used an image twice, you could not be certain where it would redirect.

In Yoast SEO 7.0 we introduced a new feature to deal with these pages. Now, we default to redirecting the attachment URL to the image itself. This basically means attachment URLs no longer exist on your site at all . This actually is a significant improvement.

Source: Yoast Blog


#5

Thanks. I did read that blog post while searching for a solution.

For this reason, I never reuse images.

In Yoast SEO 7.0 we introduced a new feature to deal with these pages. Now, we default to redirecting the attachment URL to the image itself.

I add a lot of images to every post and that old feature was preventing image theft to some extent. Now when the visitor clicks on the image, it is opening the image url which is making it easy to rob.

Of course if anyone wants to rob images, they can. But we are talking about low-tech thieves who either click on image (/ right click on image to open in new tab) to reach domain.com/wp-content/uploads/2018/01/image-name.jpg.

Thanks!


#6

In that case, you need this plugin to setup attachment redirect to the post.