Hello, i need some help. I have a website that is very well indexed by google for a lot of keywords. But i want to direct traffic on those keywords for that link to another link on another domain. How can i make that happen? I already read about 301 redirect or something on google webmaster central. And also on their forum someone posted a code to be written in .htaccess file. But there is already one htaccess file, so do i need to add it on that file for the redirect to happen? For eg. Old domain indexed on google : http://www.old.com/category1/page1.php New domain to redirect : http://www.new.com/category4/category2/page4.php Thanks
You can append the code to your existing .htaccess. I use php to redirect traffic from old to new domain with this code will fit your case if you place it on your www.old.com/category1/page1.php: <?php $newurl = "http://www.new.com/category4/category2/page4.php"; echo ' <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta http-equiv="refresh" content="1; url='.$newurl.'" /> <title>Page has moved. redirecting...</title> <meta name="robots" content="noindex,follow" /> </head> <body> <p><a href="'.$newurl.'">Redirection</a></p> </body> </html> '; ?> I still wonder how to transfer PR to the new domain. I still have PR3 on the old page and PR2 at the new.
I don't think PR can be transferred from one domain to another domain. By the way i am using Wordpress for both the websites. So if i delete the posts from old website, it will give post not found error and that's where i want to redirect to the new one.
For doing this, you add this line to .htaccess ErrorDocument 404 /category4/category2/page4.php Supposing the /category4/category2/page4.php is your redirecting page, any 'not found' error will redirect to your new site.
It goes to what you define on this line: $newurl = "http://www.new.com/category4/category2/page4.php"; Supposing you moved the domain name only, and the rest of the url must stay the same, you say: $newurl = "http://www.guitargang.org" . $_SERVER['REQUEST_URI']; Is that what you meant in your question?