实验目的:在IE中打开http://aaa.com或者http://www.aaa.com/index.html都会跳转到http://www.aaa.com/,集中PR和排名到http://www.aaa.com/
1.IXWEBHOSTING的301操作实验:
(1)在.htaccess中加入如下代码:
rewriteEngine on
rewriteCond %{http_host} ^aaa.com
rewriteRule ^(.*)$ http://www.aaa.com/$1 [R=301,L]
# Redirect client index.html requests to "/"
rewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /index.html HTTP/
rewriteRule ^index.html$ http://www.aaa.com/ [R=301,L]
(2)IE显示出错:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@aaa.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
(3)然后查询手册修改301代码如下:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.aaa.com$
RewriteRule ^(.*)$ http://www.aaa.com/$1 [R=301]
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ http://www.aaa.com/ [R=301,L]
(4)用301检查工具:http://www.internetofficer.com/seo-tool/redirect-check/,得到如下结果:
Type of redirect: 301 Moved Permanently
(5)在IE中打开http://aaa.com或者http://www.aaa.com/index.html都会跳转到http://www.aaa.com/