Am I correct that you only want to redirect viewtopic.php with a query string or is viewtopic.php embedded as if it were a directory? That’s just basic regular expressions, of course.
Replace the dreaded :kaioken: EVERYTHING :kaioken: (or nothing) atom ( the “(.*)” ) with viewtopic\.php$. If the characters following the dot-php is a query string, it’ll be appended automatically otherwise, you’ll need to ensure Options +MultiViews is in your .htaccess and add the :kaioken: EVERYTHING :kaioken: atom before the $ (after the \.php). Of course, $1 will have to change to viewtopic.php (and $1 after that if not a query string), too.
You might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It’s helped may members and should help you, tYou might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It’s helped may members and should help you, too.