wordpress-seo
wordpress-seo copied to clipboard
Redirection after slug change failed in multisite
Please give us a description of what happened.
Hello,
I'm contacting you about a bug revealed in YOAST SEO Premium (multisite) (same issue with the last version)
After editing a post slug, WPSEO create a redirections, this redirections are not stable because there are depending to wordpress native hook "redirect_canonical", exactly the function redirect_guess_404_permalink()
After many investigations, the issue with WPSEO is that :
In the Post Watcher class (wordpress-seo-premium/premium/classes/post-watcher.php:94)
WPSEO clean the url and remove the local site path => /site1/page-1/ vers /page-1/
just after he try to match with existing redirections
wordpress-seo-premium/premium/classes/redirect/redirect-handler.php:74 => set_request_url() => get_request_uri() => strip_subdirectory()
that will always fails ! because the redirections that are saved in database contain the site's path => site1/page-1/ not /page-1/
In the other side, WPSEO use the native hook "redirect_canonical" to try finding redirections, with the function redirect_canonical_fix() (wordpress-seo-premium/premium/premium.php:316)
$redirects = new WPSEO_Redirect_Option( false );
$path = wp_parse_url( $requested_url, PHP_URL_PATH );
$redirect = $redirects->get( $path );
the $redirects will always be empty with the "false" param, so it will not match .
Please describe what you expected to happen and why.
Change page slug, redirect old url to new one
How can we reproduce this behavior?
- Install WP Multisite 2.Create Page with slug : TEST 3.Update page slug to : TEST-REDIRECT 4.The old url will not works (if works try to update the slug from TEST-REDIRECT to TEST)
Technical info
- WordPress version: 5.4.2
- Yoast SEO version: 14.3
- If relevant, which editor is affected (or editors):
- [ ] Classic Editor
- [ ] Gutenberg
- [ ] Classic Editor plugin
- Which browser is affected (or browsers):
- [ ] IE11
- [ ] Edge
- [ ] Chrome
- [ ] Firefox
- [ ] Safari
- Relevant plugins in case of a bug:
- Tested with theme:
@samikerb can you please update WordPress and Yoast SEO to the latest versions to see if this solves your specific issue? We don't support older versions of our plugin and WordPress 5.4.x or lower.
This is also a premium feature, so technically it does not belong on this repository. However, since you've already gone through the trouble of looking through the code, we can re-check the issue once you've updated your versions and verified that the problem persists.
Hello,
I checked in fresh WP with the lasts versions.
Same issue
Thanks
Le mer. 16 déc. 2020 à 13:27, Djennez [email protected] a écrit :
@samikerb https://github.com/samikerb can you please update WordPress and Yoast SEO to the latest versions to see if this solves your specific issue? We don't support older versions of our plugin and WordPress 5.4 or lower.
This is also a premium feature, so technically it does not belong on this repository. However, since you've already gone through the trouble of looking through the code, we can re-check the issue once you've updated your versions and verified that the problem persists.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Yoast/wordpress-seo/issues/16478#issuecomment-746213699, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOZPISOTQG6OHDXG77KQZNLSVCRRRANCNFSM4U4SGWJQ .
I was able to reproduce the issue, I haven't confirmed the aforementioned debugging steps.
Having this same issue w/ v17.2.
problem exists in premium redirect plugin with v19.0 pro & 19.4 basic. we are using a multisite-setup with SUBDOMAIN_INSTALL = false. if we change the slug of a posting - yoast ask to add the change into the redirection list. but the handling behind ist wrong. setup is like this: MainWP: www.domain.com/ Subinstanz: www.domain.com/en Editing Posting in Subistanz from slug to slug_new yoast fills in the following rule: 301 | old url: /en/slug/ | new url: /en/slug_new/
if i request the URL https://www.domain.com/en/slug/ -> 404 returns. if i rquest the URL https://www.domain.com/en/en/slug/ -> 301 redirect to https://www.domain.com/en/slug_new/
-> So the Problem is, that the old url is including a part of wordpress->domain when created. So to fix it, you should remove in such cases the /en/ in beginning of "old Url" in your database, or you need to fix it at your redirection-function if the wordpress->domain cointains a path-part to not double this by your redirect.
Please inform the customer of conversation # 929606 when this conversation has been closed.
Please inform the customer of conversation # 948184 when this conversation has been closed.
Please inform the customer of conversation # 953481 when this conversation has been closed.
Please inform the customer of conversation # 959375 when this conversation has been closed.
Is there any insteresst in fixing this bug?!?
Please inform the customer of conversation # 1017786 when this conversation has been closed.
I'm experiencing the same issue on several multisite installs that use Yoast SEO Premium. @Djennez - any updates here? Thanks.