To achieve 301 page jump before you need to make changes to the Apache configuration such as
Apache does not open the Mod_rewrite module by default,
1, will
| The code is as follows |
Copy Code |
| #LoadModule Rewrite_module modules/mod_rewrite.so |
This line is preceded by the # number removed, http.conf Site directory configuration, the other is the space users commonly used
To
| The code is as follows |
Copy Code |
| LoadModule Rewrite_module modules/mod_rewrite.so, |
2, change allowoverride None to: allowoverride all
I. Writing. htaccess file, about 301 redirects:
1 common to the domain name without www to the domain name with www example: web site. com Redirect to www. Web site. com
| The code is as follows |
Copy Code |
Options +followsymlinks Rewriteengine on Rewritecond%{http_host} ^ website. com [NC] Rewriterule ^ (. *) $ http://www. Web site. com/$1 [l,r=301] |
If you have server privileges, we can modify it in http.conf.
Two, the Apache under the vhosts.conf configuration 301 turn.
| The code is as follows |
Copy Code |
<virtualhost *:80> DocumentRoot "E:/xxx" ServerName http://www. Domain name. Net </VirtualHost> <virtualhost *:80> ServerName domain. Net Redirectmatch permanent ^/(. *) http://www. Domain name. net$1 </VirtualHost> |
Cases
Change the domain name without www to a domain name with www
| The code is as follows |
Copy Code |
Options +followsymlinks Rewriteengine on Rewritecond%{http_host} ^xxx.cn [NC] Rewriterule ^ (. *) $ http://www.xxx,cn/$1 [l,r=301] |
Common Client Request error return code:
400-bad Request Error Requests
401 Authorization required Need verification
403 Forbidden Prohibited
404 Not Found cannot find the page
405 Method Not allowed
408 Request Timed out
411 Content Length Required
412 Precondition Failed
413 Request Entity Too Long
414 Request URI Too Long
415 Unsupported Media Type
You can use the FF browse Firebug to detect whether the 301 status code is returned