Apache 如何使用扩展斜杠重定向到HTTPS

Apache 如何使用扩展斜杠重定向到HTTPS,apache,.htaccess,redirect,Apache,.htaccess,Redirect,我在.htaccess中使用此代码 RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI}$1 [R=301,L] RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}$1 将所有请求重定向到https,例如example.com会重定

我在.htaccess中使用此代码

RewriteCond %{HTTP_HOST} !^www\.    
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI}$1 [R=301,L]     
RewriteCond %{HTTPS} off      
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}$1 

将所有请求重定向到https,例如example.com会重定向到,但我的问题是,当url类似于example.com/hello时,它会重定向到https,但会导致404错误,如果直接输入
https://www.example.com/hello
在浏览器中,它能工作吗?@anubhava这是一个示例URL没有人拥有这个域这是标准示例案例我知道这是一个示例。但不管URL给您提供了什么404,当您直接输入
https://www.example.com/hello
在浏览器中,它能工作吗?@anubhava这是一个示例URL没有人拥有这个域这是标准示例案例我知道这是一个示例。但不管URL给你们提供了什么404,它是否直接在浏览器中工作(使用https和www)