2015-11-23 42 views
0

有這個.htaccess文件的麻煩規則www.gardening-services-edinburgh.com/index.html的.htaccess改寫爲 「/」, 「/index.htm」 明明

目前

我們的.htaccess看起來像

Options +FollowSymLinks 
RewriteEngine on 
RewriteCond %{HTTP_HOST} ^gardening-services-edinburgh.com [NC] 
RewriteRule ^(.*)$ http://www.gardening-services-edinburgh.com/$1 [R=301,L] 

RewriteRule ^index\.html$/[R=301,L]        
RewriteRule ^(.*)/index\.html$ /$1/ [R=301,L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*[^/])$ /$1/ [L,R=301] 
+1

有什麼問題嗎? – hjpotter92

+0

試圖讓example.com/index.html默認爲「example.com/」 –

+0

是否啓用了mod-rewrite? – hjpotter92

回答

0

嘗試如下:

Options +FollowSymLinks +Indexes 
DirectoryIndex index.html 

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^gardening-services-edinburgh.com [NC] 
RewriteRule ^(.*)$ http://www.gardening-services-edinburgh.com/$1 [R=301,L] 

RewriteCond %{REQUEST_URI} index\.html$ 
RewriteRule ^(.*/)?index\.html$ /$1 [R=301,L] 

RewriteCond %{REQUEST_URI} !^.+/$ 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^.*$ /$0/ [R=301,L]