Redirect from sub-directory to root – New WordPress 5.2.3 Set up

At the top of your root .htaccess file (before the WordPress front-controller) add the following:

# Redirect from /subdirectory/<anything> to `/<anything>`
RewriteRule ^subdirectory/(.*) /$1 [R=302,L]

Change the 302 (temporary) to 301 (permanent) only once you have confirmed it works OK in order to avoid caching issues.

UPDATE: If I wanted to add a further rewrite /subdirectory/old-page to /new-page how would the rule change please?

You would add another rule before the above “generalised” redirect. The most specific redirect(s) should go first in order to avoid conflicts – the first rule that matches, wins in this scenario.

For example:

# Redirect from /subdirectory/old-page to `/new-page`
RewriteRule ^subdirectory/old-page$ /new-page [R=302,L]

# Redirect from /subdirectory/<anything> to `/<anything>`
RewriteRule ^subdirectory/(.*) /$1 [R=302,L]

Note that the above redirects /subdirectory/old-page exactly (ie. no trailing slash) – as in your example. If there should be a trailing slash then add a slash before the end-of-string anchor ($), in other words: ^subdirectory/old-page/$.

Or, to make the trailing slash optional, so it accepts request URLs with and without a trailing slash, use the ? quantifier. eg. ^subdirectory/old-page/?$. Now, it will match both /subdirectory/old-page and /subdirectory/old-page/ and redirect to /subdirectory/new-page (no trailing slash).