Mobile app version of vmapp.org
Login or Join
Odierno851

: 301 redirect doersnt work in SERP 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

@Odierno851

Posted in: #301Redirect #RegularExpression #Seo

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 ^(.*) exampleB.com/ [L,R=301]
</IfModule>


I am redirecting from www.exampleA.com to exampleB.com.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Odierno851

1 Comments

Sorted by latest first Latest Oldest Best

 

@Kevin317

Use HTTP_HOST not HTTP_REFERER

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?olddomain.com$ [NC]
Rewriterule ^(.*) newdomain.com/ [L,R=301]
</IfModule>

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme