I use angular with html5 mode
$routeProvider.otherwise({redirectTo : '/index' });
$locationProvider.html5Mode(true).hashPrefix('!');
and for that I have htaccess to handle google indexing
# Rewrite anything with google appended string to english version of the snapshot
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=
RewriteCond %{HTTP_HOST} ^touchtyping.guru [NC]
RewriteRule ^ snapshots%{REQUEST_URI}-en.html [L]
# Rewrite everything else to index.html to allow html5 state links
RewriteRule ^ index.html [QSA,L]
This redirects to appropriate snapshot for all the subpages, like eg:
http://touchtyping.guru/learn-touch-typing?_escaped_fragment_=
http://touchtyping.guru/index?_escaped_fragment_=
but it doesn't work for the root domain like below, rendering the /index page, instead of redirecting to it's snapshot:
http://touchtyping.guru/?_escaped_fragment_=
The snapshot exists, I tried hardcoded index-en.html there, but no success. Seems like htaccess doesn't catch the query string in this case, loading angular routing. How can I fix that?
UPDATE--------------------------------------
The whole htaccess file:
RewriteEngine on
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Redirect http://www. to just http://
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=
RewriteCond %{HTTP_HOST} ^touchtyping.guru [NC]
RewriteRule ^ snapshots%{REQUEST_URI}-en.html [L]
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=
RewriteCond %{HTTP_HOST} ^(es|pl|en).touchtyping.guru [NC]
RewriteRule ^ snapshots%{REQUEST_URI}-%1.html [L]
# Rewrite everything else to index.html to allow html5 state links
RewriteRule ^ index.html [QSA,L]