WordPress htaccess rewrite rules with url parameter

Solution:

This meets requirements, it also handles www or not. Works at the end of .htaccess so it doesn’t conflict WordPress rules:

RewriteCond %{HTTP_HOST} ^mywebsite\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mywebsite\.com$
RewriteRule ^test\.php$ "http\:\/\/mywebsite\.com\/test\/" [R=301,L]