I am in the final stage of updating a website and changed many url's for SEO purposes. Now I want to keep the social scores for most pages, most importantly the Facebook likes and comments. It has been confirmed that this is possible. See the following link for reference: How can I move a URL via 301 redirect and retain the page's Facebook likes and Open Graph information?
- og:url on newurl.html page should be oldurl.html -> done
- keep valid page with old og tags named oldurl.html -> done
- redirect from oldurl.html to newurl.html -> done
- exempt the Facebook crawler from this redirect -> I don't know how
I can't find an answer on how to this and there have been other people asking the same question with no answer. Only got purple links left on this subject and do not know what to do or search anymore.
How do does one stop a crawler from following a redirect?
Edit. I know now that this won't work this way but it is the best I can do. One of the conditions being don't be Facebook and then all the rules bundled together for that condition without having to repeat the condition for every rule:
RewriteCond %{HTTP_USER_AGENT} !facebookexternalhit/[0-9]
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^old-url1\.html$ http://domain.com/new-folder/new-url1.html? [N,R=301]
RewriteRule ^old-url2\.html$ http://domain.com/new-folder/new-url2.html? [N,R=301]
RewriteRule ^old-url3\.html$ http://domain.com/new-folder/new-url3.html? [L,R=301]
Edit2. I'll have to go with the repeat for every rule. Many url's changed name. Something more elegant might be possible but that is way beyond my ability. Does it have a significant influence on page load time if the code below is repeated 60 times with different url's?
RewriteCond %{HTTP_USER_AGENT} !facebookexternalhit/[0-9]
RewriteRule ^old-url1\.html$ http://domain.com/new-folder/new-url1.html? [L,R=301]