URLs ending in /1/ automatically redirect and strip /1/
-
I am currently staging/testing the WP 4.5.1 upgrade for a couple of my sites, and I have noticed a peculiar behavior with my Custom Post Type pagination.
From what I can see, WP 4.5.1 will not let me put a “/1/” at the end of a URL… With WP 4.4.2 I have been using URLs like the following:
https://mysite.loc/post-slug/
https://mysite.loc/post-slug/1/
https://mysite.loc/post-slug/2/
https://mysite.loc/post-slug/3/
etc….Where the trailing number represents the page within the custom post type. What I see now is the following redirect happens regardless of what I do:
https://mysite.loc/post-slug/1/ ==> https://mysite.loc/post-slug/
I tried adding
print_r($post);die();
to the top of the single-custom-post-type.php template file in my themes folder to try to debug, but URLs ending in /1/ never make it to the custom post template file (the redirect happens on the https://mysite.loc/post-slug/1/ page request and then I see the print_r($post) output on https://mysite.loc/post-slug/ after the 301).
To test the issue, I installed a new/clean version of WP 4.5.1 with the out-of-the-box Twenty Sixteen Theme and I tried the following page combinations:
https://mysite.loc/2016/05/03/hello-world/
https://mysite.loc/2016/05/03/hello-world/1/
https://mysite.loc/2016/05/03/hello-world/2/
https://mysite.loc/2016/05/03/hello-world/3/Of the above 4 URLs, the 1st, 3rd and 4th URLs will render my “Hello World” Post, while the 2nd URL will always redirect to the 1st.
As a work-around I can obviously adjust the pagination in my custom post type to start number at page 2 instead of page 1. But I would rather not invest time in a work-around without understanding why my implementation is not working after the 4.4.2 to 4.5.1 Upgrade.
- The topic ‘URLs ending in /1/ automatically redirect and strip /1/’ is closed to new replies.