Php 将index.html重定向到根htaccess,将非www重定向到www?

Php 将index.html重定向到根htaccess,将非www重定向到www?,php,regex,.htaccess,redirect,Php,Regex,.htaccess,Redirect,我写的这段代码是对的还是错的 重新启动发动机 重写cond%{HTTP_HOST}^www.cogxim.com$[NC] 重写规则^.*$http://www.cogxim.com/$1[L,R=301] RewriteCond%{THE_REQUEST}^.*/index.html 重写规则^.*index.html$http://www.cogxim.com/$1[R=301,L] 指定如下内容以将非www流量重定向到www RewriteEngine On Rewrit

我写的这段代码是对的还是错的

重新启动发动机 重写cond%{HTTP_HOST}^www.cogxim.com$[NC] 重写规则^.*$http://www.cogxim.com/$1[L,R=301] RewriteCond%{THE_REQUEST}^.*/index.html 重写规则^.*index.html$http://www.cogxim.com/$1[R=301,L]
指定如下内容以将非www流量重定向到www

    RewriteEngine On 
    RewriteCond %{REQUEST_FILENAME} ^.*/index.html
    RewriteRule ^(.*)index.html$ http://www.cogxim.com/$1 [R=301,L]
    RewriteCond %{HTTP_HOST} ^cogxim.com
    RewriteRule (.*) http://www.cogxim.com/$1 [R=301,L