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

Wildcard redirects conflict when redirecting to parent URL #374

Open
1 task done
jessuppi opened this issue Mar 22, 2024 · 1 comment
Open
1 task done

Wildcard redirects conflict when redirecting to parent URL #374

jessuppi opened this issue Mar 22, 2024 · 1 comment
Labels
type:bug Something isn’t working.

Comments

@jessuppi
Copy link

Describe the bug

Firstly, thank you so much to @10up and team for their incredible contributions to open source over the years, and beyond that, offering an inspiring example of good ethics and good quality to the community. You have impressed me for a long time and I should say this publicly somewhere, so thank you.

This might not be a "bug" because it seems like the plugin is meant to behave this way: #182

However, I think it could be considered a bug. Here's an example scenario:

  1. Tons of 404 errors/spam queries are being sent to "child" pages of a given parent page such as:
  • /real-page/deleted-page/
  • /real-page/random-url-from-spam-bot/
  • /real-page/random-url-from-ddos-attacks-etc/
  1. In this scenario, we use Safe Redirect Manager and add a new rule:
  • redirect /real-page/* (all child content) to /real-page/ which is the parent URL (and the only page we want)
  1. This currently results in a redirect loop, because /* is treated the same as / in Safe Redirect Manager, which appears to be by design. However, if possible, I would suggest treating these differently, unless it's difficult because of WordPress limitations and the way trailing slashes are interpreted?

I have tried using regex for this scenario, and it seems the child redirects work, but the parent page still gets stuck in a redirect loop in the tests that I ran.

Steps to Reproduce

  1. redirecting wildcard children /page/* to parent /page/ results in redirect loop

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jessuppi jessuppi added the type:bug Something isn’t working. label Mar 22, 2024
@icodeforlove
Copy link

One solution is to just not use paths which require a / at the end as this is not too common of a approach.

For example:

  • /real-page/deleted-page
  • /real-page/random-url-from-spam-bot
  • /real-page/random-url-from-ddos-attacks-etc

This way the wild cards would still work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn’t working.
Projects
Status: Incoming
Development

No branches or pull requests

2 participants