How to resolve website 301 redirection, including IIS, Apache, ASP, and PHP

Source: Internet
Author: User
Tags website hosting

Permanent page removal (301 redirection) is a very important "auto redirect" technology.

First, a tool is provided to check the server header information. Simply put, it is used to check whether 301 of your site is successful. Don't underestimate this 301. If it is made into 302 or something, your website may have to make you happy and worried.

Detection address: http://www.seoconsultants.com/tools/headers.asp#results

301 redirection promotes Search Engine Optimization
From the perspective of search engine optimization, 301 redirection is the most feasible method for URL redirection. When the domain name of a website changes, the search engine only indexes the new website and transfers the original external links under the old address to the new one, in this way, the ranking of websites will not be affected by changes in the website. Similarly, when you use the 301 permanent redirection command to direct multiple domain names to the primary domain of the website, the ranking of the website will not have any negative impact.

302 redirection affects Search Engine Optimization
So far, only Google has excellent processing capabilities for 302 redirection. That is to say, when a website uses the 302 redirection command to direct other domain names to the primary domain, only Google will include the link scores of other domain names in the primary domain, other search engines only share the link score to multiple domain names, reducing the total number of links on the main site. Since the number of external links, one of the key factors in website ranking, has been affected, it is also natural for websites to fall in rankings.

To sum up, among the many redirection technologies, 301 permanent redirection is the most secure and ideal solution.

For the correct implementation of 301 redirection, there are several methods for your reference:

1. Add the 301 redirection command to the. htaccess file.

The "mod_rewrite" technology is used, for example:CopyCodeThe Code is as follows: rewriteengine on
Rewriterule ^ (. *) $ http://www.william long.info/#1 [R = 301, l]

2. Applicable to users who use Unix network servers

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.williamlong.info/

3. Complete 301 redirection in the system administrator configuration area of the server software.

Applicable to users who use Windows Network Servers

4. Bind/local DNS

If you have the permission to edit and modify local DNS records, you only need to add a record to solve this problem. If you do not have this permission, you can ask the website hosting service provider to set the DNS server accordingly.

DNS server settings

To direct blog.william amlong.info to www.william amlong.info, you only need to add an alias record in the DNS service and write it as blog in cname www.william amlong.info.

If you need to configure a large number of virtual domain names, you can write them as * In cname www.william amlong.info.

In this way, all unconfigured records ending with William long.info can be redirected to www.william long.info.

5. Implement 301 redirection using ASP/PHP:

ASP:Copy codeThe Code is as follows: Response. Status = "301 moved permanently"
Response. addheader "location", "http://www.williamlong.info /"
Response. End

PHP:Copy codeThe Code is as follows: Header ("HTTP/1.1 301 moved permanently ");
Header ("Location: http://www.williamlong.info /");
Exit ();

Related Article

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.