Morning

So with some help I set this up a while back. It redirects/rewrites all index files to root and no www to www. I then found out that it was redirecting all my addon domains to www.maindomain.com/addondomain. I then added some fixes to it. BUT! Now if I don't have a index in the addon domain it redirects to www.maindomain.com/addondomain again. Is this normal behavior for said code? Or is there something amiss with the code? I need this fixed because I dont want google thinking any addon domains are subdirectories of the main domain. Thanks!