我几乎尝试了所有解决方案,但没有取得成功
这些是我在htaccess文件上尝试的尝试
1
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
2
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*[^/])$ /$1/ [L,R=301]
3
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} ^$
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]
</IfModule>
4
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !index.htm
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://domain.com/$1/ [L,R=301]
完全沮丧......可以做些什么呢?
答案 0 :(得分:0)
您可以使用:
RewriteEngine On
RewriteCond %{REQUEST_URI} !\.
RewriteRule !.+/$ %{REQUEST_URI}/ [L,R=301]