我试图写一些条件来添加不带.html
的尾随斜杠或重定向网址,并从/
.html
例如:
https://www.example.com/page -> https://www.example.com/page/
https://www.example.com/page.html/ -> https://www.example.com/page.html
这是我的.htaccess
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^[^/]+$ %{REQUEST_URI}/ [L,R=301]
我做错了什么?