301 usage and error details-php Tutorial

Source: Internet
Author: User
301 usage and error details

  1. Options + FollowSymLinks
  2. RewriteEngine on
  3. RewriteCond % {HTTP_HOST} ^ domain.com [NC]
  4. RewriteRule ^ (. *) $ http://www.domain.com/#1 [L, R = 301]

If you are using a Windows host, set 301 redirection on the control panel. Recommended for editing: php pseudo-static url rewrite rewrite rules: an example of php url rewrite path rewriting

Supplement: answering Shi touwang's question in the URL standardization comment may be helpful to you:

As far as I know, HTML cannot perform 301 redirection. Only JS or meta refresh can be used in HTML, but not 301 redirection. Once the HTML is read, the 200 OK status code is returned.

If your page is ASP or PHP, you can also perform 301 redirection: ASP:

  1. <% @ Language = VBScript %>
  2. <%
  3. Response. Status = "301 Moved Permanently" Response. AddHeader "Location", "http://www.domain.com"
  4. >

PHP:

  1. Header ("HTTP/1.1 301 Moved Permanently ");
  2. Header ("Location: http://www.domain.com ");
  3. ?>

In addition, the DOThtaccess file is just a common text file. you can use Notepad to create this file and place the command in the root directory of your account. You do not need to modify Apache.

Q: How long can the search engine process a page with 301 redirection?

After a webpage is reoriented with 301, will the pages of old domain names indexed by the original search engine be transferred to the new domain name directed. What will happen to the page of the old domain name indexed by the search engine? for example, how long will it take for the content in the old domain name to be transferred to the new domain name after site: www.xxx.com.

A: If your old website uses HTTP 301 (permanent) redirection to direct to your new website, the new website will be automatically notified during search engine roaming and automatically updated within six to eight weeks.

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.

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.