Adding `www` causing it to have index.php I am trying to get pretty urls 

In my general.php file I have 

'omitScriptNameInUrls' =&gt; true,


which works fine and removes the index.php 

BUT

When I try to force a www in the htaccess the index.php comes back and I can't seem to remove this.

This is what I have in my htaccess

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]


Any thoughts?
Your .htaccess is basically saying "Redirect example.com to www.example.com". 

OK, that's cool. so you want to add www to any request that a comes in. I'm guessing you put this after Craft's code? 

This actually needs to come before you send the request to Craft.

So, your example should look like this:

&lt;IfModule mod_rewrite.c&gt;

  #Make sure the rewrite engine is on
  RewriteEngine On

  # Redirect non-www requests to www
  RewriteCond %{HTTP_HOST} ^example\.com [NC] 
  RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]

  # Send would-be 404 requests to Craft
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
  RewriteRule (.+) index.php?p=$1 [QSA,L]

&lt;/IfModule&gt;