I searched, read and experimented for the whole day but could not make it work.
In my angularjs site I have
$locationProvider.html5Mode(false);
$locationProvider.hashPrefix('!');
So, my links are like,
http://example.com/#!/home
http://example.com/#!/folder1/folder2
According to AngularJS SEO docs, crawlers will see above links as,
http://example.com/?_escaped_fragment_=/home
http://example.com/?_escaped_fragment_=/folder1/folder2
Now, my goal is to write some rules in .htaccess to redirect crawlers to some snapshot folder and static html files. So, when the crawlers try to go to the above links, they should be redirected to,
http://example.com/snapshot/home
http://example.com/snapshot/folder1/folder2
I have almost no experience with .htaccess files and very little knowledge of Perl Regex.
Please do not give only links as answers since I have googled and tried lots of combinations.
I also referred to this stackoverflow link, and experimented with my .htaccess file, but could not make it redirect to the snapshot folder.
Can anyone please help me make it work?
*********************** UPDATE 1 ********************************
As per @Olaf Dietsche's answer, I wrote these 2 lines (and these 2 only) in my .htaccess file
RewriteCond %{QUERY_STRING} _escaped_fragment_=([^&]*)
RewriteRule ^$ /snapshot/%1 [R,L]
The result is, when I am hitting
http://example.com/?_escaped_fragment_=/home
in my browser, the url is becoming
https://example.com:80/snapshot//home?_escaped_fragment_=/home
expected is http://example.com/snapshot/home
So, current issues are,
- the 'http' becomes 'https', hence getting SSL connection error
- a port number :80 comes suddenly, which was not there
- 2 forward slashes '//' after snapshot
- after 'home' the previously '?_escaped_fragment_=/home' also stays, which should not be there
Help please...