We are not certain of your "scope" of work.
Are you asking how to do this type of task on the service "htaccess"?
"You should avoid using .htaccess files completely if you have access to httpd main server config file".
It's kind of fun to do the impossible! -Walter Elias Disney