title: .htaccess redirecting index.php to root for main domain
body: <p>I want to redirect only my domain index.php file to root of the website, like this:</p>
  
  <p><strong>www.domain.com/index.php</strong> to <strong>www.domain.com</strong></p>
  
  <p>but not for my subdomains, like this one:</p>
  
  <p><strong>shop.domain.com/index.php</strong>.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>#Rewrite non www to www, except subdomains
  RewriteCond %{HTTP_HOST} !^shop.domain.com$
  RewriteCond %{HTTP_HOST} !^sub.domain.com$
  RewriteCond %{HTTP_HOST} !^www.domain.com$
  RewriteRule ^(.*) http://www.domain.com/$1 [QSA,L,R=301]
  
  #Rewrite index.php to root
  RewriteCond %{THE_REQUEST} ^.*/index\.php 
  RewriteRule ^(.*)index.php$ /$1 [R=301,L]
  </code></pre>
  
  <p>Please help.. Thanks in advance..</p>