Home > OS >  WordPress Redirection Plugin Redirect
WordPress Redirection Plugin Redirect

Time:03-11

I'm trying to redirect a page and any subpages to the root but I can't find a way of doing it. I'm using the redirection plugin (https://redirection.me/). I would rather doing it via the plugin to keep all redirects in one place rather than .htaccess.

I would like to redirect https://www.example.co.uk/developments/ and any subpages e.g. https://www.example.co.uk/developments/test or https://www.example.co.uk/developments/another-test etc. to the home page.

I tried just now it seemed to break the subpages so I had to revert the redirect.

This is what I was trying to use in the source URL: /developments/development-name/*

And the target URL: /

With REGEX and Ignore Slashes enabled.

CodePudding user response:

/developments/development-name/* is not what you want. It looks like you are trying to do globbing with that *. In regex, the equivalent of a glob * is .* where . means "any character" and .* means zero or more of any character.

The rule that would implement a redirect to the home page is:

  • source: /developments/.*
  • target: /

However, redirecting to the home page is not usually a good idea. It is usually better to remove the content and show a custom 410 Gone error saying why the content was removed. When you redirect to the home page:

  • Users don't get a meaningful error message and get frustrated with the bad user experience
  • Search engines call it a "soft 404" error and treat it just like the content was removed, so you don't get any SEO benefit.
  • Related