1

On my website, I have following url structure:

example.com/test/
example.com/test/a-page
example.com/test/another-page

How can I redirect all of the URLS that contains /test/ right after the domain name to example.com/info/

I understand I can do it using htaccess, but I cannot format the rule syntax.

0

Try the following at the top of your .htaccess file, before the existing WordPress directives:

RewriteRule ^test/ /info/ [R=302,L]

The pattern ^test/ matches all URLs that start /test/.

Note that the URL-path matched by the RewriteRule pattern (first argument) does not start with a slash (when used in .htaccess).

If this is intended to be permanent then change the 302 to 301 - but only after you have tested that it works OK.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.