📅  最后修改于: 2023-12-03 15:34:43.231000             🧑  作者: Mango
The RewriteEngine On
line enables the Apache mod_rewrite
module, which allows for URL rewriting and redirection.
The RewriteCond %{SERVER_PORT} 80
line specifies a condition for the following RewriteRule
. It checks for the server port being set to 80
, which is the default HTTP port.
The RewriteRule
line specifies the actual URL redirection. Here, any incoming URL that matches the pattern ^(.*)$
(which includes any character any number of times) will be redirected to https://www.example.com/$1
, where $1
is the matched pattern from the original URL.
The [R,L]
flags at the end of the RewriteRule
specify that the redirection should be a permanent redirect (R=301
) and that this should be the last rule applied (L
, which stands for "last").