HTTP 到 HTTP Apache2 Rewrite 未使用

HTTP 到 HTTP Apache2 Rewrite 未使用

我希望透過 HTTP 發送的所有流量都會重定向到連接埠 443。

我目前在網站可用的apache2 目錄中為連接埠80 設定了重寫規則,但是當我轉到該連接埠上的該位址時,它仍然會將我帶到預設的Ubuntu apache 頁面,而不是重定向到HTTPS站點。

在此輸入影像描述

我在可用站點中只有 1 個conf 文件,相關部分如下所示:

<VirtualHost x.x.x.x:80>
    ServerAdmin [email protected]
    ServerName some.dns.com
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
</VirtualHost>

我重新啟動了apache並檢查沒有錯誤。還有其他地方需要更新嗎?

相關內容