我想知道是否有人可以帮助解决一个小的 .htaccess 问题。
例如,在 .htaccess 文件中是这样的:
Options -Indexes
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
# Normal
RewriteRule ^about$ ./about.html [L,NC]
RewriteRule ^news$ ./news.html [L,NC]
RewriteRule ^other$ ./other.html [L,NC]
如果您想强制执行 HTTPS 并且在 domain.com/about 之后没有正斜杠,这非常有用
我的问题是:
如何强制执行 HTTPS 并在末尾添加正斜杠,如下所示;
或允许用户在末尾添加正斜杠,而不会将其重定向到 404 错误页面。
它们也只是服务器主文件夹中的 HTML 页面。
有一次,您必须创建文件夹“about”、“news”、“others”等,并在每个文件夹中放置一个 index.html 文件,其中包含所有图像、css 和 js 等,以获得正斜杠。
我希望这可以做到。
谢谢!