.htaccess 将尾部斜杠添加到url
我正在Drupal7站点上工作,该站点需要在分类标签页面的URL末尾有一个尾随斜杠,但对于扩展名为“.htm”的节点页面则不需要 我通过编辑drupal的.htaccess文件尝试了这一点,我添加了以下代码:.htaccess 将尾部斜杠添加到url,.htaccess,drupal-7,lighttpd,trailing-slash,.htaccess,Drupal 7,Lighttpd,Trailing Slash,我正在Drupal7站点上工作,该站点需要在分类标签页面的URL末尾有一个尾随斜杠,但对于扩展名为“.htm”的节点页面则不需要 我通过编辑drupal的.htaccess文件尝试了这一点,我添加了以下代码: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d #RewriteCond %{REQUEST_URI} !=/favicon.ico #RewriteRule ^ index.php [L] R
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服务器
提前感谢。您是否在domain.com根目录下的.htaccess文件顶部有此文件? 发动机是否按如下所示打开? .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]
Drupal 7的尾部斜杠模块: