Attachment page 404 not found when image is attached to post

I have this new WP webiste I’m working on. Today I was going to design the attachment.php page so that my image pages would look nice, but found that I was getting a 404 for all of them actually. I’ve tried everything I could think of…

  • I’ve tried deactivating all plugins, nothing changed.
  • I’ve tried changing the theme to twenty sixteen, nothing changed.
  • I’ve tried going to the permalinks page and resaving the structure, nothing changed.

But then I’ve found two things that kind of worked, but I’m not able to really take these clues any further myself. These are the things I’ve tried that actually changed something:

  • If I change the permalink structure to “Plain”, the attachments page loads fine.
  • With my desired “Post name” permalink structure images that are attached to a post give a 404 when trying to load in a single page, however images that are not attached to any post load fine.
    This image is not attached to posts: https://wikiarquitectura.com/wp/en/libreteria-6-ppal-7
    This image is attached to one post: https://wikiarquitectura.com/wp/en/building/fisher-house/casa_fisher_3

Any hints as to what might be the problem here would be greatly appreciated.

Thanks in advance.

Solutions Collecting From Web of "Attachment page 404 not found when image is attached to post"