i need redirect:
To clarify, what you need is an internal URL "rewrite" (the URL in the browser's address bar does not change), not strictly a "redirect", which would imply an external "redirect" (an additional HTTP request).
Try something like the following at the top of your
.htaccess file in the document root (which I assume is
/var/www/page/.htaccess) using mod_rewrite:
RewriteRule ^index/product/id/\d+$ script/index.php [L]
Where your "ANY ID" is 1 or more digits at the end of the URL-path.
UPDATE: You can then extract the id by parsing the
$_SERVER['REQUEST_URI']) superglobal in your PHP script. (But note that
$_SERVER['REQUEST_URI'] also potentially contains a query string.)
Alternatively, you can explicitly pass the id to your script, as @StephenOstermiller mentioned in comments. For example:
RewriteRule ^index/product/id/(\d+)$ script/index.php?id=$1 [QSA,L]
You could then access the id value using PHP's
QSA flag is necessary if you are expecting any additional query string parameters on the original request URL, in order to append them to the rewritten URL.