Tutorial :Unable to make a 301 domain redirection for a long url in .htaccess



Question:

I just moved my siteA.com to siteB.com. I am trying to put traffic from siteA.com to siteB.com.

My .htaccess file which 301 redirection does not work

RewriteEngine On  RewriteCond %{HTTP_HOST} ^www.siteA.com/home/3-Tips-in-Math.html$  RewriteRule ^/?$ "http://www.siteB.com/home/3-Tips-in-Math.html" [R=301,L]  

How can you make the above code to work?


Solution:1

Try this rule:

RewriteCond %{HTTP_HOST} !^www\.siteB\.example$  RewriteRule ^ http://www.siteB.example%{REQUEST_URI} [L,R=301]  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »