您应该使用重定向来处理此问题301
,将其置于您已经定义的规则之上:
RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
在您已经定义的规则中删除可选的尾部斜杠标志也是值得的,因此您的结果.htaccess
文件将如下所示:
RewriteEngine On
RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
RewriteRule ^Start/$ index.php [NC,L]
RewriteRule ^Info/$ info.php [NC,L]
RewriteRule ^Gallery/$ gallery.php [NC,L]
为了避免第一个条件也重写有效文件,您应该添加另一个条件:
RewriteCond %{REQUEST_FILENAME} !-f
最后,你.htaccess
应该看起来像:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
RewriteRule ^Start/$ index.php [NC,L]
RewriteRule ^Info/$ info.php [NC,L]
RewriteRule ^Gallery/$ gallery.php [NC,L]