hello i've my primary domian thet i've its very own cmd system www.maindomain.com

as well as subdomain thet call sub.mainfomain.com

during my htacsess i refer all of the files to become handle torugh the index.php page

with this command RewriteEngine on RewriteRule sitemap.xml sitemap.php RewriteRule index.html index.php

RewriteCond %{HTTP_HOST} ^mainsite.com [NC] 
RewriteRule ^(.*)$ http://www.%{SERVER_NAME}/$1 [L,R=301] 
RewriteRule ^(.*)PHPSESSID=[a-zA-Z0-9]*(.*) $1$2 [L,QSA]

RewriteCond %{HTTP_HOST} ^sub.mainsite.co.il [NC] 
RewriteRule ^(.*)$ http://www.%{SERVER_NAME}/$1 [L,R=301] 
#RewriteRule ^(.*)$ http://.%{SERVER_NAME}/$1 [L,R=301] 


RewriteRule ^(.*)PHPSESSID=[a-zA-Z0-9]*(.*) $1$2 [L,QSA]

# Rewrite indexes of the form 'index.php?q=x':
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?qs=$1 [L,QSA]

i'm able to arrive at the index.php in sub.mainsite.com however i get error 500 basically attempt to o to anthor page.

i believe thet the final row within the htacses file result in the problem

1.how do i repair it? 2.can one make htacsess file to the somainsubdomain?

thanks