Reputation: 24731
I have a domain that I want to do a wildcard 301 redirect with. All incoming traffic should do a 301 redirect if the user-agent is not a popular search engine like Google, Yahoo, Bing. If it is Google, Yahoo or Bing user agents, it can return a 404.
How do I do this?
Upvotes: 0
Views: 1923
Reputation: 24731
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} googlebot|yahoobot|microsoftbot [NC]
RewriteRule ^.*$ - [R=404,L]
#else
Redirect 301 / http://www.somesite.com/
Upvotes: 2
Reputation: 41219
You can do it like
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} google|bing|yahoo [NC]
RewriteRule ^.*$ - [R=404,L]
This will redirect any request to 404 for these user_agents.
Upvotes: -1