[wp-trac] [WordPress Trac] #44039: attachment rewrite rule redirects to posts instead of showing 404

WordPress Trac noreply at wordpress.org
Thu May 10 17:04:23 UTC 2018


#44039: attachment rewrite rule redirects to posts instead of showing 404
---------------------------+-----------------------------
 Reporter:  swedish boy    |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Rewrite Rules  |    Version:
 Severity:  minor          |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 Instead of showing 404 for an invalid attachment slug, you will be
 redirected to a valid post slug.

 The blog is set to permalink structure `%postname%`

 The attachment rule for this is `[^/]+/([^/]+)/?$`

 And the rewrite is `index.php?attachment=$matches[1]`

 Tested on a clean WordPress-installation running twentyseventeen if you
 visit /hello-world/sample-page/
 you will be redirected to /sample-page.

 Is this really how it should be?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44039>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list