I must use mod_rewrite to redirect to some page basically will find personal files with different pattern determined in the URI

The road to the file to complement


The HTTP request


The mod_rewrite configuration:
-first line: extract cat1, cat2, and cat3 with regular expressions
-second line: make an effort to match file using regular expression variables
-3rd line: if match effective redirect to page

RewriteCond %{QUERY_STRING} ^/(.*)/(.*)/(.*)$
RewriteCond /path/to/dir/$1_$2_$3 -f
RewriteRule /some_page.html

For whatever reason it does not work. Any assistance is appreciated.

Do this:

RewriteCond /path/to/dir/$1_$2_$3 -f
RewriteRule ^/(.*)/(.*)/(.*)$ /some_page.html

The RewriteCond lines are examined after mod_rewrite understands that the RewriteRule matches, so that you can make use of the $N values there.

Your original version might have labored too, with the exception that: you had been matching against QUERY_STRING the part following the ? inside a request -- you most likely meant REQUEST_URI you ought to have used %N to reference to the prior RewriteCond and also you were missing the pattern area of the RewriteRule.