Here is my .htaccess file
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^abc/products-(.+)$ def/products-$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]
</IfModule>
I have many url links in /abc/ sub-directory, like
http://www.domain.com/abc/products-12345
http://www.domain.com/abc/products-23456
http://www.domain.com/abc/products-34567
http://www.domain.com/abc/new-items
Now I want to url rewrite /abc/products- to /def/products-
http://www.domain.com/def/products-12345
http://www.domain.com/def/products-23456
http://www.domain.com/def/products-34567
http://www.domain.com/abc/new-items
the code: RewriteRule ^abc/products-(.+)$ def/products-$1 [R=301,L] could make the page redirect, but the it when type http://www.domain.com/abc/products-12345 the browser will go to http://www.domain.com/def/products-12345 but the page show as 404. If I remove it, http://www.domain.com/abc/products-12345 could run well. Why and How to? Thanks.
Update:
I have moved RewriteRule ^abc/products-(.+)$ def/products-$1 [R=301,L] ahead of RewriteRule ^index\.php$ - [L] still get 404.
And I add echo get_query_var('page_id'); in 404.php, this return 0.
why the url could redirect but miss the right page?