Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We are using a mod rewritten URL within our PHP site, this is the rewrite rule we are using:

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

However, a user of a different system is switching to our setup and wants to 301 all their old pages to their new equivalents. So, for example, this URL:


Is it possible to do this in a single rewrite rule or rewrite match (or similar), my intial thought was something like this would work:

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

Also tried this with RedirectMatch which also doesnt work:

RedirectMatch /categories/(.*)/(.*)/1$1/$2/0-0-0-0-0-0-0-0/1

it doesn't, any ideas?

share|improve this question
up vote 0 down vote accepted

fixed myself with this rule:

RedirectMatch 301 /categories/(.*)/(.*)/(.*)$1/$2/0-0-0-0-0-0-0-0/$3
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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