php - redirect bots and crawlers via .htaccess -


hi , problem want redirect bots , crawlers site5 , real visitors site4 can see in schema

http://i.stack.imgur.com/y3ofd.jpg

what did created .htaccess file , put in site1.com/folder/ :

    rewriteengine on      rewritecond %{http_user_agent} googlebot [or]     rewritecond %{http_user_agent} msnbot [or]     rewritecond %{http_user_agent} slurp     rewritecond %{http_user_agent} facebookexternalhit/1.1      rewriterule ^(.*)$ http://site2.com/xyz/$1 [l,r=301] 

and did same in site2.com redirect site4.com

did miss something?

regards

first, make sure apache setup functions correctly.

after try like

rewriteengine on  rewritecond %{http_host} site3.com$ [nc] rewritecond %{http_user_agent} googlebot [or] rewritecond %{http_user_agent} msnbot rewriterule ^(.*)$ http://site4.com/$1 [l,r=301] 

to test can use simple curl simulate google bot request:

curl -a "googlebot/2.1 (+http://www.googlebot.com/bot.html)" http://site3.com 

or headers only

curl -x head -i -a "googlebot/2.1 (+http://www.googlebot.com/bot.html)" http://site3.com 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

php - How do you embed a video into a custom theme on WordPress? -