Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Origin module causes Redirect error in GSC #713

Open
RavanH opened this issue Feb 19, 2025 · 2 comments
Open

Origin module causes Redirect error in GSC #713

RavanH opened this issue Feb 19, 2025 · 2 comments

Comments

@RavanH
Copy link

RavanH commented Feb 19, 2025

Describe the bug
With the Origin module in the Extension Manager activated, some /?attachment_id=XXX URLs will not get properly redirected. Although the response is a 301, there is no location header. This causes GSC to report them as "Redirect error"

To Reproduce
Steps to reproduce the behavior:

  1. Go to Media in the WordPress admin
  2. Upload an image file, without assigning it to any post or page, take note of the image ID
  3. In a new tab, go to the site main URL and append ?attachment_id= followed by the ID from step 2
  4. Hit enter, the page will remain blank.

Expected behavior
There should be a redirect to the image location (WordPress default behavior) or a redirect to the attached page or post (Origin module behavior) but neither happens because the first is overruled while the second does not apply.

I would suggest falling back to the WP default redirection when no attached page or post is found.

@sybrew sybrew transferred this issue from sybrew/The-SEO-Framework-Extension-Manager Feb 21, 2025
@sybrew
Copy link
Owner

sybrew commented Feb 21, 2025

Hello! Thanks for the report 😃

This can only happen if the post_parent points to a post that has been deleted.
WordPress intends to clean up these pointers when a post gets deleted, but it's possible that this doesn't always happen properly.

We should add a check to test whether the page parent can be found and redirect to the image directly instead.

@RavanH
Copy link
Author

RavanH commented Feb 21, 2025

Hi Sybre,

This can only happen if the post_parent points to a post that has been deleted.

Ah, that would indeed explain things...

We should add a check to test whether the page parent can be found and redirect to the image directly instead.

Sounds like a plan :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants