【发布时间】:2018-04-26 00:43:51
【问题描述】:
我想将所有带有 google 引用的尾部斜杠的 URL 重定向到没有尾部斜杠的新 URL。
示例: http://example.com/toto/ ===> 到http://example.com/toto
警告我已经重写了规则以避免 .html 扩展名!
这是我现有的代码:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
RewriteCond %{REQUEST_URI} (.+)$
RewriteRule ^ %1 [R=301,L]
</IfModule>
我收到以下错误:
Not Found
The requested URL /example/.html was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
【问题讨论】: