Skip to content

Wildcard redirects conflict when redirecting to parent URL #374

@jessuppi

Description

@jessuppi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugSomething isn’t working.

    Type

    No type

    Projects

    Status

    Incoming

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions