If you want to rewrite a URL to https in the same virtualhost that you run http, you can add the flag RewriteCond %{HTTPS} !=on, like this:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(/test)$ https://%{SERVER_NAME}$1 [R,L]
If you want to rewrite a URL to https in the same virtualhost that you run http, you can add the flag RewriteCond %{HTTPS} !=on, like this:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(/test)$ https://%{SERVER_NAME}$1 [R,L]