Ok, so I have this script to do my testing, which works perfectly.
<?php
$string = 'https://www.website.com/this/sub/dir/page.php/reset/this/var';
$regex = '#(.*)[/](.*)\.php(.*)#';
$replace = '\\1/\\2.php?vars=\\3';
$output = preg_replace($regex, $replace, $string);
echo 'Orig: '.$string.'<br />';
echo 'Output: '.$output;
?>
When I apply it to .htaccess as
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)[/](.*)\.php(.*)$ $1/$2.php?vars=$3
I get "No input file specified.", which is better than 500+404. This tells me that Apache is still kinda getting a 404 even after the rewrite.
Anyone have any ideas?
TIA.