1. 程式人生 > >www.aaa.com/index.html跳轉www.aaa.com設定

www.aaa.com/index.html跳轉www.aaa.com設定

.htaccess檔案,跳轉程式碼如下:

<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On

    RewriteRule ^index.html$ http://www.qiuxue365.cn/ [L,R=301]
    RewriteRule ^index/index.html$ http://www.qiuxue365.cn/ [L,R=301]
   
    RewriteCond %{http_host} ^qiuxue365.cn [NC]                // 頂級域名跳轉
    RewriteRule ^(.*)$ http://www.qiuxue365.cn/$1 [L,R=301]    // 頂級域名跳轉
RewriteCond %{REQUEST_URI} /+[^\.]+$ RewriteRule ^(.+[^/])$ %{REQUEST_URI}.html [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
用自己的網站www.qiuxue365.cn測試了,成功返回301: