Is it not simpler to use robots.txt to block them?
RewriteEngine On RewriteBase / RewriteCond %{HTTP_USER_AGENT} !google|yahoo|bing [NC] RewriteCond %{HTTP_REFERER} !google|yahoo|bing [NC] RewriteCond %{REQUEST_URI} !^.*/mobile/ RewriteCond %{REQUEST_FILENAME} !^/index.html$ RewriteRule ^([a-z]+)-(.+)\.html$ /#$1/$2 [NE,R=301,L] RewriteCond %{REQUEST_URI} !^.*/#[a-z]+/[.*]$ RewriteRule ^([a-z]+)\.html$ /#$1 [NE,R=301,L]Staging server on Ubuntu 14.04 ppc (powermac G4), hosted in an "seo2" subdirectory:
RewriteEngine On RewriteBase / RewriteCond %{HTTP_USER_AGENT} !google|yahoo|bing [NC] RewriteCond %{HTTP_REFERER} !google|yahoo|bing [NC] RewriteCond %{REQUEST_URI} !^.*/mobile/.*$ RewriteCond %{REQUEST_URI} !^.*/index.html$ RewriteRule ([a-z]+)-(.+)\.html$ /seo2/#$1/$2 [NE,R,L] RewriteCond %{HTTP_USER_AGENT} !google|yahoo|bing [NC] RewriteCond %{HTTP_REFERER} !google|yahoo|bing [NC] RewriteCond %{REQUEST_URI} !^.*/mobile/.*$ RewriteCond %{REQUEST_URI} !^.*/#[a-z]+/[.*]$ RewriteRule ([a-z]+)\.html$ /seo2/#$1 [NE,R,L]Not found any good online htaccess documentation or tutorials (relied a lot on stackoverflow), so these evolved through a lot of trial and (mostly) error.