I've found SO many questions asking how to do this but NONE of them work for me:

```
####TRYING TO HANDLE WWW HERE
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.|$) [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,QSA,NC,L]
</IfModule>

####WORDPRESS RULES
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

####CAKEPHP RULES
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_URI} !^/$
RewriteRule (.*) app/webroot/$1 [L]

```

I want to make it so that any non-WWW URL is redirected to the WWW.\* equivalent. Currently I get a redirect loop no matter what I do.

I'm trying to avoid hardcoding the URL because it needs to work on a couple different servers, including some on subdomains: sub.example.com --> www.sub.example.com