I have a site that I'm manually translating. The normal version is in English and the translated version is in Spanish.
The translated version is accessible through http://example.com/file.php?language=es (es for espanol) I want the URL after the domain to be unaltered by the change in translation, so I'm trying to use http://es.example.com/ instead.
This is the current state of my htaccess:
RewriteCond %{HTTP_HOST} !^example\.site$
RewriteRule home/$ /index.php [L,QSA]
RewriteRule contact-us/$ /contact-us.php [L,QSA]
RewriteRule our-location/$ /our-location.php [L,QSA]
RewriteRule gallery/$ /gallery.php [L,QSA]
RewriteRule (.*)/$ /user.php?display_name=$1 [L,QSA]
RewriteCond %{HTTP_HOST} !^es\.example\.site$
RewriteRule home/$ /index.php?language=es [L,QSA]
RewriteRule contact-us/$ /contact-us.php?language=es [L,QSA]
RewriteRule our-location/$ /our-location.php?language=es [L,QSA]
RewriteRule gallery/$ /gallery.php?language=es [L,QSA]
RewriteRule (.*)/$ /user.php?language=es&display_name=$1 [L,QSA]
The first set of rules under !^example.site$ all override the rules from under !^es.example.site$, so when I access the pages with or without the "es" subdomain, I'm getting the English version either way. If I place the subdomain rules (and rewrite condition) above the non-subdomain rules then the same thing happens except the site is only translated in Spanish.
Any help would be greatly appreciated.
EDIT:
The fixed rules, thanks to the help of @hjpotter92
RewriteRule ^home/?$ /index.php [NC,QSA,S=3]
RewriteRule ^(contact-us|our-location|gallery)/?$ /$1.php [NC,QSA,S=2]
RewriteRule ^(?!user\.php).*/$ /user.php?display_name=$0 [NC,QSA]
RewriteCond %{HTTP_HOST} ^es\.example\.site$ [NC]
RewriteCond %{QUERY_STRING} !language=es [NC]
RewriteRule ^.*$ /$0?language=es [L,QSA]