We're utilizing a mod rewritten URL inside our PHP site, this is actually the rewrite rule we're using:

RewriteRule ^category/([^.]+)/([0-9]+)/([^.]+)/([0-9]+) categories.php?c_id=$2&filters=$3&_p=$4&area=category&areaname=$1

However, a person of the different product is switching to the setup and wishes to 301 almost all their old pages for their new counterparts. So, for instance, this URL:




Can you really do that in one rewrite rule or rewrite match (or similar), my intial thought was something similar to this could work:

RewriteRule /categories/(.*)/(.*)/1 /category/$1/$2/0-0-0-0-0-0-0-0/1 [R=301,L]

it does not, any ideas?

Also attempted this with RedirectMatch that also does not work:

RedirectMatch /categories/(.*)/(.*)/1 http://domain.com/category/$1/$2/0-0-0-0-0-0-0-0/1

fixed myself with this particular rule:

RedirectMatch 301 /categories/(.*)/(.*)/(.*) http://domain.com/category/$1/$2/0-0-0-0-0-0-0-0/$3

Here’s a mod_rewrite example:

RewriteRule ^categories/([^/]+/[^/]+)/([^/]+)$ /category/$1/0-0-0-0/$2 [L,R=301]

Your example is redirecting the alternative method to how you need it from what I can tell.

/category/abc/def/0-0-0-0-0-0-0-0/1 to /categories/abc/def/1