Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.76k stars 885 forks source link

Redirection after slug change failed in multisite #16478

Open samikerb opened 3 years ago

samikerb commented 3 years ago

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?

  1. 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

Djennez commented 3 years ago

@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.

samikerb commented 3 years ago

Hello,

I checked in fresh WP with the lasts versions.

Same issue

Thanks

Le mer. 16 déc. 2020 à 13:27, Djennez notifications@github.com 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 .

Djennez commented 3 years ago

I was able to reproduce the issue, I haven't confirmed the aforementioned debugging steps.

heyjones commented 2 years ago

Having this same issue w/ v17.2.

karlkowald commented 2 years ago

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.

rohans456 commented 1 year ago

Please inform the customer of conversation # 929606 when this conversation has been closed.

rohans456 commented 1 year ago

Please inform the customer of conversation # 948184 when this conversation has been closed.

rmarcano commented 1 year ago

Please inform the customer of conversation # 953481 when this conversation has been closed.

rumejan commented 1 year ago

Please inform the customer of conversation # 959375 when this conversation has been closed.

karlkowald commented 1 year ago

Is there any insteresst in fixing this bug?!?

rohans456 commented 1 year ago

Please inform the customer of conversation # 1017786 when this conversation has been closed.

gregbob13 commented 10 months ago

I'm experiencing the same issue on several multisite installs that use Yoast SEO Premium. @Djennez - any updates here? Thanks.

VictoriaMcCarter commented 2 weeks ago

Please inform the customer of conversation # 1164017 when this conversation has been closed.

heyjones commented 2 weeks ago

Please inform the customer of conversation # 1164017 when this conversation has been closed.

Sorry, which conversation? That link doesn’t appear to be working.