How to do 301 redirection for SEO website optimization
301 Redirect Many people do not understand it or know how to use it, which leads to confusion in the use of domain names and is not conducive to search engine optimization.Next, let's talk about 301 redirection.
What does 301 redirect mean?
In the address bar, enter:
For example, in Hongtao's blog, the domain name ihucc.com can be seen to automatically jump to ihucc.com. This effect is 301 redirection.
But not allHigh end website constructionThe virtual hosts of all support such operations. The conditions for such operations are:
1. The Linux virtual host Apache server needs to support the. htaccess file.(Check with the host vendor for support) If so, first resolve the two domain names to the same IP address, and then add the following rules at the beginning of the. htaccess file:
code:
RewriteCond %{http_host} ^AAA.com [NC]
RewriteRule ^(.*)$ //www.AAA.com/$1 [R=301.L]
It should be noted that the. htaccess file can't be modified directly when it is transferred to the local. We can edit it by modifying it to. htaccess. txt. After writing the code to be written, directly transfer. htaccess. txt to the space, and then directly change. htaccess. txt to. htaccess file name by FTP. This will improve the efficiency!
2. The ISAPI_Rewrite component must be installed on the IIS server of the virtual host of the window.(Check with the host vendor for support) If so, first resolve the two domain names to the same IP address, and then add the following rules at the beginning of the httpd.ini file:
code:
RewriteCond Host:^AAA.com$
RewriteRule (.*) //www.AAA.com$1 [R,I]
If the above code is not feasible, please try this code:
code:
[ISAPI_Rewrite]
CacheClockRate 3600
RepeatLimit 32
RewriteCond Host: ^hongtaoseo.com$
RewriteRule (.*) //www.hongtaoseo.com$1 [I,RP]
Most virtual hosts do not support such operations. What should we do now?
The above 301 redirection operation mode is not necessary. If the host does not support it, the following methods can also achieve the same effect.
1. If the domain name and website are brand new, that is, the domain name without www has not been included for the time being, the domain name without www can be used to forward to the domain name with www.Forwarding is set in the background of domain name management, and some domestic domain name vendors are also not allowed to forward.
2. If the website has existed for a period of time and the domain name without www has also been included in many pages, the domain name with www and without www will be used to resolve to the website's IP at the same time.Then, the website's main navigation, classification, or secondary navigation and other important locations should use the absolute address with www as far as possible.
Related questions?
1. Why do you want to transfer domain names without www to those with www through 301 or other methods?
This is mainly for the purpose of URL standardization, so that the weight of the website is concentrated on a certain domain name, rather than scattered.
2. Can I 301 a domain name with www to a domain name without www?
If you find that domain names without www rank better or have a lot of content, you can transfer the domain name with www to the domain name without www.
The reason why we suggest that the 301 without www be transferred to the 301 with www is mainly because of the Chinese habit of using domain names.
3. Domain names without www will not be resolved or forwarded, OK?
Because many people may enter domain names without www when visiting your website, it is recommended to bind them.
4. Is it necessary to also 301 index.html or index.php to the main domain name?
This is unnecessary.Because the purpose of 301 is to concentrate weight, as long asBeijing website productionThe main domain name is used as the address, that is, the URL without index is used as the anchor text, which can realize the function of centralized weight.When all links do not have an index, users and search engines will not access the URL with an index.