Force www in .htaccess file

What is the correct way to force www in the .htaccess file when using CS-Cart. I've tried the normal code found all over the web, but it doesn't work with CS-Cart. Is there somewhere specific I'm supposed to put it in relation to the other Rewrite code CS-Cart adds? Also, how would I do this for http and https?

config.local.php


// Host and directory where software is installed on no-secure server
$config['http_host'] = 'www.your_domain.com';
$config['http_path'] = '';

// Host and directory where software is installed on secure server
$config['https_host'] = 'www.your_domain.com';
$config['https_path'] = '';