Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 将尾部斜杠添加到url_.htaccess_Drupal 7_Lighttpd_Trailing Slash - Fatal编程技术网

.htaccess 将尾部斜杠添加到url

.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

我正在Drupal7站点上工作,该站点需要在分类标签页面的URL末尾有一个尾随斜杠,但对于扩展名为“.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服务器


提前感谢。

您是否在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的尾部斜杠模块: