2014-02-19 38 views
0

我想清理任何不必要的代碼行的.htaccess文件。這是我對那裏現在:.htaccess文件中的額外行

Options +FollowSymLinks 
RewriteEngine on 
RewriteCond %{HTTP_HOST} !^www.aicmillworks.com$ [NC] 
RewriteRule ^(.*)$ http://www.aicmillworks.com/$1 [L,R=301] 
ReWriteRule ^home$/[R=301,L] 
RewriteCond %{THE_REQUEST} \ /([^\?\ .]*)\.(?:\?|\ |$) 
RewriteRule^/%1 [L,R=301] 
RewriteCond %{HTTP_USER_AGENT} libwww-perl.*  
RewriteRule .* – [F,L] 

這兩條線「上RewriteEngine敘述」之後是與重定向非www到www頁面。之後的所有行,我不知道他們做什麼或爲什麼他們在那裏。刪除它們還是更好一些,或者它們對我的網站很重要?他們在做什麼?

回答

1

我不完全確定第三者做了什麼,但其餘規則解釋如下。

# Redirect: prepend www. if the domain does not start with www. 
RewriteCond %{HTTP_HOST} !^www.aicmillworks.com$ [NC] 
RewriteRule ^(.*)$ http://www.aicmillworks.com/$1 [L,R=301] 

# Redirect: /home to/
ReWriteRule ^home$/[R=301,L] 

# Redirect: strip the file format. So /test.html redirects to /test 
# I tried testing this on your site, but it didn't work, so I'm not sure if you have this rule enabled or not. 
RewriteCond %{THE_REQUEST} \ /([^\?\ .]*)\.(?:\?|\ |$) 
RewriteRule^/%1 [L,R=301] 

# Block libwww-perl from your website. Usually for blocking bots 
RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
RewriteRule .* – [F,L] 

至於「這將是更好的對其進行刪除或者是他們對我的網站的重要莫名其妙?」,他們肯定不會傷害你的網站,所以你不妨離開他們。

+0

@webbysteph你爲什麼不接受這個答案的任何理由? –