I'd like to 301 redirect all .com/language/X URLs to .com/members/?members_search=X.

Test case:
http://example.com/language/french should 301 redirect to

The rule I have set up:

RedirectMatch 301 "^/language/(.*)" "/members/?members_search=$1"

It works correctly when I use a .htaccess tester. The rule is at the very top of the .htaccess file. Any ideas?

  • 1
    Sorry for the confusion. Swap out "expertise" for "language" in the rule. It should be RedirectMatch 301 "^/language/(.*)" "/members/?members_search=$1
    – Jennifer
    Commented Mar 3, 2021 at 1:14
  • 1
    Just edited it.
    – Jennifer
    Commented Mar 3, 2021 at 1:20

1 Answer 1


Even though you've placed this rule at the top of the .htaccess file, RedirectMatch is a mod_alias directive so still runs after other mod_rewrite (ie. RewriteRule) directives, so you may have a conflict.

Try changing this to a mod_rewrite directive. For example:

RewriteRule ^language/(.*) /members/?members_search=$1 [R=301,L]

NB: No slash prefix on the RewriteRule pattern when used inside .htaccess files.

You will likely need to clear your browser cache before testing. Preferably test with 302 (temporary) redirects to avoid potential caching issues.

  • 1
    It's working! Thank you!
    – Jennifer
    Commented Mar 3, 2021 at 1:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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