简体   繁体   中英

.htaccess 301 redirect not working on WordPress site

I'm trying to redirect domain.com/our-team/team-member/ to domain.com/about/

Here is the .htaccess code that I'm using:

RedirectMatch 301 ^/our-team/team-member(.*) ^/about/$1

However what happens with that code is that I'm redirected to http://domain.com/about/team-member/ , which is essentially 404 page.

I've tried numerous variations on this htaccess rule with no luck as of yet.

Could something else be at play here? Could this be related to the way WordPress works, or something going on with the shared Go Daddy hosting environment the site is hosted in?

You have a bad target URL starting with ^ . Also it is better not to mix mod_alias rules ie RedirectMatch with other mod_rewrite rules of WP. Use this rule just below RewriteBase line in your main WP htaccess:

RewriteRule ^our-team/team-member(/.*)?$ /about$1 [L,R=301,NC]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM