Referrer rediretion via .htaccess - Can you help?

Bross

Senior Member
Joined
Feb 6, 2010
Messages
859
Reaction score
355
Hi guys,

I need to redirect traffic to a specific page if they reach via google/bing, etc..
Can anyone copy paste the rewrite rule here? I am having a hard time.

Thanks + Rep guaranteed.
 
Check if the following code work for you. Remember to clear your browser cache before testing the htacess. It will even redirect if the referrer is google.co.uk.
Code:
RewriteEngine on
 
RewriteCond %{HTTP_REFERER} ^http:\/\/([^.]+.)*?google.[a-zA-Z_]+ [NC]
RewriteRule (.*) http://www.site-to-redirect-to.com/newpage.html [R=301,L]
RewriteCond %{HTTP_REFERER} ^http:\/\/([^.]+.)*?bing.[a-zA-Z_]+ [NC]
RewriteRule (.*) http://www.site-to-redirect-to.com/newpage.html [R=301,L]
 
Back
Top