Does your website set 301 redirection for a domain name without WWW?

Source: Internet
Author: User
Tags url forwarding

301 redirection

Does your website set a domain name without WWW during domain name resolution? Set a domain name without www. In this way, you can access your website normally when using a domain name without www.

However, we often encounter this situation. When other websites link to your website, the following link will be used:

Www.example.com
Example.com/
Www. example. Om/index.html
Example.com/index.html

As a result, the prvalue of the primary domain name of your site is distributed to several other URLs. In the search engine's opinion, URLs with or without WWW are two different URLs. When they direct to the same website, the search engine will not know which URL should be selected as the primary URL.

If you use 301 redirection to convert other URLs such as example.com
Www.example.com
PR is also concentrated in the primary domain name: www.example.com.

Although Google can set the preferred domain name in the Google website administrator center, this setting is prepared for some people who cannot set the 301 issue. Setting the preferred domain name is the same as setting the 301 issue, however, this is only effective for Google. The 301 setting is still required. After all, it is required for all search engines.
Differences between URL forwarding and 301 redirection

After testing, we found that there are different concepts in URL forwarding, domain name binding, 301 permanent redirection, 302 temporary targeting, and meta forwarding.

URL forwarding: divided into explicit and implicit forwarding. If Seo is used, the latter directly drops K. The following url forwarding generally refers to explicit forwarding.

There is one saying: URL Forwarding is not conducive to Seo, It is not delivered to PR, 301 is very friendly to Seo, and PR can be transferred. However, some code returned by the URL forwarding test is 301. As mentioned below.

The existing URLs are forwarded to the new domain names. However, if code is used for 301 redirection, it is generally only valid for the homepage. Although htaccess can achieve the goal, win does not support it. The best way is to have redirection in the IIS Console (how to test the effect), or htaccess support (use a regular expression to achieve the corresponding redirection of each path, which is equivalent to replacing the domain name)

As for the difference between 301 and 302:

After 301, the new website completely inherits the old website, and the ranking of the old website is completely cleared.
After the implementation of 302, there is no impact on the old web site, but the new web site will not rank.

302 even if the website is not a spam objectively, it is easy for search engines to misjudge and punish spam.

Meta fresh: specifically, the meta command in the webpage redirects to the new webpage after a specific time. If the delay is too short (within 5 seconds ), is determined as spam.
301 specific redirection methods:

1. Set the. htaccess file (only applicable to Linux systems and supported by virtual hosts .)

The access to example.com/will be automatically forwarded to www.example.com
Write the following code in the. htaccess file.

(The code in the original article is a little problematic. When writing the code, note that the rewritecond is followed by a regular expression. If an error is written, it does not take effect)

Rewriteengine on
Rewritecond % {http_host} ^ (szwision \. com) (: 80 )? [Nc]
Rewriterule ^ (. *) $ http://www.szwision.com/#1 [L, r = 301]

Note: URL-standardized 301 redirection (the above Code) must be written before other URL-Rewrite code.

2. Applicable to users using UNIX systems

Use this command to notify the search engine spider that your site file is not under this address. This is a common method.

Shape: Redirect 301/http://www.example.com

3. Applicable to Windows users

Set URL forwarding in the domain name management backend. Set example.com without WWW, and enter www.example.com with WWW in the following box to set it to explicit forwarding. Explicit Forwarding is equivalent to 301, and implicit Forwarding is equivalent to 302, which is dangerous.

However, it is worth mentioning that because of the different concepts of URL forwarding and 301, not all explicit Forwarding is 301 (I heard that the URL forwarding provided by hichina is 302 ), you can use the header information query tool provided by the http://tool.alimama.com/tools.php to query example.com if the Returned Code has "HTTP/1.1 301 moved permanently ". Congratulations, that's 301. My website is xinnet, And the URL explicitly forwarded by xinnet is 301. I used this method.

If you are a hichina host and a Windows host, use DNS alias resolution.

4. Use ASP/PHP to implement 301 redirection:

ASP:
Response. Status = "301 moved permanently"
Response. addheader "location", "http://www.example.com /"
Response. End

PHP:
Header ("HTTP/1.1 301 moved permanently ");
Header ("Location: http://www.example.com /");
Exit ();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.