[wp-hackers] Changing page permalink structure

Otto otto at ottodestruct.com
Tue Oct 2 22:25:01 UTC 2012


On Tue, Oct 2, 2012 at 12:30 PM, Bryan Petty <bryan at ibaku.net> wrote:
>> - If I turn the URL into http://mydomain.com/page-slug-3/, a 301 redirect
>> is done to http://mydomain.com/page-slug-1/page-slug-2/page-slug-3/(redirect
>> is based on the page slug). It also works if you have the
>> following URL :  http://mydomain.com/page-slug-1/page-slug-3/
>> - So we can say that reparenting is covered unless one of the slugs has
>> changed.
>> - If you change any slug (parents or the page itself) you get a 404
>
> However, this is not what I see with either 3.4.2 or 3.5-beta-1. As
> long as the final page slug remains unchanged, I can change any of the
> parent page slugs, and the old URL will be redirected to the correct
> page with the updated parent page slugs. I suspect this is just
> because WordPress only looks at the final slug, not because it's
> correctly tracking the parent page slugs, otherwise the case above
> would probably work.

You will probably get different results depending on what your Custom
Permalink Structure is set to. If you're not using a numeric field at
the beginning of the Custom Permalink string, then Pages get handled
differently. For example, using %postname% alone would probably cause
the redirect to fail, because now the WP core code is checking for
complete URL paths for pages, to differentiate Pages from Posts. With
a numeric there, that code would not happen, and then the fall-through
to the 404 guesser might catch your page instead.

Test with the Month-Name structure and the Postname structure and see
if there is a difference.

-Otto


More information about the wp-hackers mailing list