2011-12-21 117 views
0

我正在使用drupal 7網站,該網站需要在分類標記頁的網址末尾有一個尾部斜線,但不包括擴展名爲「.htm」的節點頁面。將追加斜槓添加到網址

我曾通過編輯的Drupal的.htaccess文件試過,我添加以下代碼:

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
#RewriteCond %{REQUEST_URI} !=/favicon.ico 
#RewriteRule^index.php [L] 
RewriteCond %{REQUEST_URI} !*.htm 
RewriteCond %{REQUEST_URI} !(.*)/$ 
RewriteRule ^(.*)$ http://domain.com/$1/ [L,R=301] 

但是這不是爲我工作。任何人都可以建議我如何完成這項工作。

注:我的工作光的httpd服務器上http://www.lighttpd.net/

在此先感謝。

回答

0

你是否在domain.com根目錄下的.htaccess文件頂部有這個? 下面是RewriteEngine嗎? 在.htaccess文件中執行其他規則,而不是這個規則,以及當它不起作用時會發生什麼。

嘗試低於這個代碼,其被清理一點

RewriteEngine On 
RewriteBase/


RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
#is not an htm/l file 
RewriteCond %{REQUEST_URI} !\.html?$ [NC] 
#does not end with a slash 
RewriteCond %{REQUEST_URI} !/$ 
RewriteRule ^(.+)$ http://domain.com/$1/ [L,R=301]