1、用.htaccess301将index.html、index.php等重定向到主域名:
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.abc.org/ [R=301,L]
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.abc.org/ [R=301,L]

本文详细介绍了如何使用.htaccess文件进行301重定向,包括将index.html、index.php重定向到主域名,内页重定向到首页,其他域名重定向到主域名,去除index.php并跳转带www的域名,以及强制HTTP转HTTPS。这些方法经作者亲测有效,对于网站优化具有重要意义。

2405

被折叠的 条评论
为什么被折叠?



