[wp-trac] [WordPress Trac] #27019: Redirect by page slug does not work in permalink structure /%category%/%postname%/

WordPress Trac noreply at wordpress.org
Wed Feb 5 08:44:37 UTC 2014


#27019: Redirect by page slug does not work in permalink structure
/%category%/%postname%/
--------------------------+-----------------------------
 Reporter:  dimagsv       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Permalinks    |    Version:  3.8.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Wordpress has a feature to redirect by page slug. For ex. site with two
 pages:
 {{{
 yoursite.com/pageone/pagetwo
 }}}
 With default permalink settings redirect works like this:
 {{{
 yoursite.com/pagetwo -> yoursite.com/pageone/pagetwo
 yoursite.com/randomtext/pagetwo -> yoursite.com/pageone/pagetwo
 }}}
 With permalink structure '''/%category%/%postname%/''' redirection from
 root stops working:
 {{{
 yoursite.com/pagetwo - 404 error
 }}}
 , but from non root ok:
 {{{
 yoursite.com/randomtext/pagetwo -> yoursite.com/pageone/pagetwo
 }}}

 How to reproduce. Clean wordpress install. Create pages: "pageone",
 "pagetwo" with parent page "pageone". Try to open url:
 {{{
 yoursite.com/pagetwo - 301 moved
 }}}
 Set custom permalink structure to '''/%category%/%postname%/'''. Try to
 open url:
 {{{
 yoursite.com/pagetwo - 404 error, but 301 expected
 }}}

 I think, permalink structure is for post, not for pages. Am I right?

 After investigations I found, "pagetwo" in url "yoursite.com/pagetwo"
 detected as category name in class-wp.php/'''parse_request()'''. And later
 canonical.php/'''redirect_guess_404_permalink()''' does not try to find
 page by category name, only by get_query_var('name'), that is blank.

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


More information about the wp-trac mailing list