#61931 closed defect (bug) (fixed)
sitemap.xml redirect no longer works when using custom permalinks
Reported by: | gmariani405 | Owned by: | swissspidy |
---|---|---|---|
Milestone: | 6.7 | Priority: | normal |
Severity: | normal | Version: | 5.5 |
Component: | Sitemaps | Keywords: | has-patch commit has-screenshots has-testing-info has-unit-tests |
Focuses: | Cc: |
Description
The XML sitemap functionality from WordPress 5.5 fails to handle the /sitemap.xml -> /wp-sitemap.xml redirect if custom permalinks are used. If you use any of the built-in permlinks modes, the redirect functions fine, but if you set it to a custom permalink that is dis-similar to the built-in ones it breaks because it is only looking to pull values from the built-in regular expression matches. The /wp-sitemap.xml itself still continues to work.
In the sites where the redirect breaks, I have this as the Custom Structure:
/%category%/%postname%/
/%category%/%year%/%monthnum%/%postname%/
Change History (13)
This ticket was mentioned in PR #7249 on WordPress/wordpress-develop by @swissspidy.
7 weeks ago
#2
- Keywords has-patch added
@swissspidy commented on PR #7249:
7 weeks ago
#3
cc @pbiron
@euthelup commented on PR #7249:
3 days ago
#4
After testing this case I can confirm the issue on wordpress:trunk
branch. With a custom permalink set, if I try to visit http://localhost:8889/sitemap.xml
I get a redirect to the "404 - not found" template.
After switching to swissspidy:fix/61931-sitemap-redirect
when I visit http://localhost:8889/sitemap.xml
I get a redirect to http://localhost:8889/wp-sitemap.xml
and I can see the proper Sitemap template.
Good job! 👍
@peterwilsoncc commented on PR #7249:
25 hours ago
#6
Are you able to add a test case for the permalink structures noted in the ticket?
#7
@
20 hours ago
- Keywords has-screenshots has-testing-info added
Hi @peterwilsoncc
Test Report
Description
This report validates whether the indicated patch works as expected.
Patch tested: https://github.com/WordPress/wordpress-develop/pull/7249
Environment
- WordPress: 6.7-alpha-58576-src
- PHP: 8.2.15
- Server: nginx/1.25.3
- Database: mysqli (Server: 8.0.36 / Client: mysqlnd 8.2.15)
- Browser: Chrome 129.0.0.0
- OS: macOS
- Theme: Twenty Twenty-Four 1.2
- MU Plugins:
- Safe Autoloaded Options Limit Test (MU Plugin) 1.0
- Plugins:
- Test Reports 1.1.0
Actual Results
- ✅ Issue resolved with patch.
Additional Notes
- Scenarios I checked :
- Fresh WordPress Setup
- Default Permalink, URL redirection ✅
- Custom Permalink, URL redirection ✅
Supplemental Artifacts
Please check the visual here : https://drive.google.com/file/d/1gm_0T3o4doJi-fmmEysmyYuUR9De7Q5z/view?usp=drive_link
This ticket was mentioned in Slack in #core by chaion07. View the logs.
18 hours ago
#9
@
18 hours ago
Thanks @gmariani405 for reporting this. We reviewed this Ticket during a recent bug-scrub session. Kudos to Krupa for adding the Test Reports and acknowledging that the patch is working as expected. We also believe that this is ready for commit. Thanks.
Props to @krupajnanda for the Test Results and @pratiklondhe for the discussion.
Cheers!
@swissspidy commented on PR #7249:
17 hours ago
#13
Committed in https://core.trac.wordpress.org/changeset/59228
Trac ticket: https://core.trac.wordpress.org/ticket/61931