Forcing HTTPS Redirects Published April 5, 2018 · Updated April 4, 2019 · Reading time: 1 min read · Categories: Tech Machine-translated (anthropic, claude-haiku-5-5) from the Chinese original. Read the original in 中文 Contents Apache Nginx Apache Create a .htaccess file in the website root directory textCopyRewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L] Nginx textCopyif ($server_port = 80) { rewrite ^(.*)$ https://$host$1 permanent; }
Comments