• Resolved David Attard

    (@dattardwp-21)


    Hello,

    I would like to perform a redirect for a large number of pages from a subdirectory to the parent directory

    i.e.

    from /subfolder/post1, /subfolder/post2, /subfolder/post5 to /subfolder

    I’ve added the regular expression /subfolder/.* to redirect to /subfolder/ but even though the /subfolder page exists, any of the posts I try are throwing a 404 error.

    What am I doing wrong? Is this functionality supported?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author John Godley

    (@johnny5)

    Yes it is supported. Have you looked at https://redirection.me/support/redirect-regular-expressions/ to see if you have configured it properly? Can you clear your browser cache after creating the redirect.

    You will probably create an infinite redirect with your above regular expression, so you may want to tweak it to not match /subfolder/

    Thread Starter David Attard

    (@dattardwp-21)

    Yes I did read it and one of the examples is /.* so I thought if I just add that as a start, it should work nicely. I tried the above on two different sites both using the plugin and the problem is the same on both.

    These are my exact settings

    Source URL: /subfolder/.*
    Target URL: /subfolder/

    Yes, I did clear the cache and it still throws a 404 error. The subfolder page exists, when I access it directly it works ok.

    Plugin Author John Godley

    (@johnny5)

    Can you confirm you checked the ‘regex’ checkbox?

    I would also change .* to .+ otherwise you will match the target

    Thread Starter David Attard

    (@dattardwp-21)

    Oh shoot, I can’t believe it, it was the checkbox, not checked. Was taking it for granted that it was just taking the regex even if you don’t check the checkbox.

    Thanks so much!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Wildcard redirect’ is closed to new replies.