![](/img/trans.png)
[英]How to redirect ALL the traffic from port 80 to a debugging proxy in Linux?
[英]SOLVED Redirect all requests from port 80 to 443
我有一个 vps 设置,代理配置为通过 vpn 重定向到我的家庭服务器。
如何禁用端口 80,以便当用户在浏览器中键入 http://my.domain时,他将被重定向到https://my.domain ? 或者我如何仅启用安全连接?
例如,查看http://vk.com - 即使您打开 http 链接,它也会创建安全的 Z5E0561Z500A1C47BAADE6 连接。
如果我只保留 <VirtualHost *:443> 并从 /etc/apache2/sites-available/myconf.conf 中删除 <VirtualHost *:80> 它会在我打开http://my.domain时显示默认 apache2 页面
我找到了解决方案。
<VirtualHost *:80>
ServerName my.domain
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</VirtualHost>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.