From the perspective of SEO, 301 redirection is the most feasible way to redirect URLs. When the domain name of the site changes, the search engine will only index the new URLs, but also the old address under the original external links to the new address, so that the site will not be ranked because of the change in the slightest impact. Similarly, when you use the 301 Permanent redirect command to point multiple domain names to the site's home domain, there is no negative impact on the site's ranking.
In general, there are two ways to achieve 301 redirects.
Modify the. htaccess file
The code is as follows:
Rewriteengine Onrewritecond%{http_host} bkjia.com$ [Nc]rewriterule ^ (. *) $ http://bkjia.com/$1 [R=301,L]RewriteCond%{ Http_host} bkjia.info$ [Nc]rewriterule ^ (. *) $ http://bkjia.com/$1 [r=301,l]
The key code is 2 words:
Rewritecond%{http_host} bkjia.com$ [Nc]rewriterule ^ (. *) $ http://bkjia.com/$1 [r=301,l]
The domain name above is the old domain name that needs to be redirected, below is the domain name of the website now.
Using the redirect code for PHP
Create a new index.php file, and then refer to the following code to make simple changes to your own redirection requirements:
If you redirect only one domain name, you can simplify the code to the following form:
Note that the last exit () function is certain to write, I did not write initially, the result can only redirect the homepage, such as Http://www.bkjia.com/guestbook Web page, can not be redirected.
Finally, some details about redirection: If you want to redirect three domain names, before redirecting, first bind these three domain names as addon domain to my server, and let these three domains point to the same folder, so Just modify the. htaccess file or the index.php file in this folder. If you do not have a. htaccess file or a index.php file, create a new one.
http://www.bkjia.com/PHPjc/752567.html www.bkjia.com true http://www.bkjia.com/PHPjc/752567.html techarticle from the perspective of SEO, 301 redirection is the most feasible way to redirect URLs. When the domain name of the site changes, the search engine only to the new URL index, at the same time ...