我一直在寻找能够强制执行的代码片段https://.我发现了这个:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Run Code Online (Sandbox Code Playgroud)
问题是,当我想在本地工作,所以像"localhost"或"example.dev"这样的网址尝试重定向到https://localhost(它不起作用).
我该如何解决这个问题?
(总而言之,我希望上面的代码片段仅在我在制作时使用时才起作用,例如"example.com")