How do we ReWrite HTACCESS to point a cat/subcat Product URL, to Cat/ only?

When I refresh the error page, it just refreshes.

If the rule has been put in the correct place in the .htaccess file (ie. near the top of the file before the existing WordPress code block) then you shouldn’t be seeing an “error page” at all (if the redirect occurred correctly).

(If you place this rule later in the .htaccess file, after the WordPress code block, then it won’t do anything as it’s not going to be processed.)

However, the rule you’ve posted is not correct either (at least in terms of the example URL you’ve posted). That rule would redirect the (incorrect) URL /shop/mens/jeans/jean-product/ to /shop/jean-product (also incorrect), note the absence of /mens/jeans (when only /jeans should be omitted) and the removal of the trailing slash.

To redirect /shop/mens/jeans/jean-product/ to /shop/mens/jean-product/ (ie. removing the 3rd path segment) then the rule should look like this instead:

RewriteRule ^(shop/[^/]+)/[^/]+/([^/]+)/?$ /$1/$2 [R=301,L]

From your example, the $1 backreference would contain shop/mens and $2 contains jean-product (note the absence of the front and trailing slashes). No need to repeat shop in the substitution string since we are capturing that from the requested URL.

Note that you must test first with a 302 (temporary) redirect to avoid potential caching issues. 301 (permanent) redirects are cached persistently by the browser (and possibly intermediate caches) so can make testing problematic. You need to clear your browser cache before testing.

Note the difference in the capturing subpatterns between your original rule and the rule I posted above:

# Your original rule
#                 |----------| (Part that is removed)
RewriteRule ^shop/[^/]+/[^/]+/([^/]+)/?$ /shop/$1 [R=301,L]
# New rule
#                         |----| (Part that is removed) 
RewriteRule ^(shop/[^/]+)/[^/]+/([^/]+)/?$ /$1/$2 [R=301,L]

casinojojobetpulibet girişOnwin Güncel Giriştürkçe altyazılı pornocanlı bahis casinocanlı bahis casino siteleriOnwin Güncel Girişholiganbetholiganbet girişholiganbet güncel giriş