I setup a 301 redirect on my root that points to a new domain. When I type the old domain URL into browser 301 works just fine. When I do a keyword search for my site and click on the link it still takes me to my old site. Below is the code:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(.*)?exampleA\.com [NC]
Rewriterule ^(.*) http://exampleB.com/ [L,R=301]

I am redirecting from http://www.exampleA.com to http://exampleB.com.



<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$ [NC]
Rewriterule ^(.*) http://newdomain.com/ [L,R=301]
| improve this answer | |
  • Awesome!!! Thank!!! Is there a way to exclude my Wordpress back-end and sitemaps from this? I am still working on a few 301's – dasickle Aug 15 '14 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.