[英]Redirect ALL http requests to https using F3 Fat-Free Framework
I guess the title says it all. 我想标题说明了一切。 I want anytime the browser to makes a request starting with http:// to change to https://
我想在任何时候浏览器发出以http://开头的请求以更改为https://
I am using the F3 framework, so I have routes set up. 我正在使用F3框架,所以已经设置了路由。 I'm not sure if I should add a route for this?
我不确定是否应该为此添加路线? If so, what would the line look like?
如果是这样,那条线是什么样的?
Or should I modify the .htaccess file in the f3 document root? 还是应该修改f3文档根目录中的.htaccess文件? I have been trying this route and it is not working.
我一直在尝试此路线,但无法正常工作。 All browser requests with http:// are remaining that way.
所有带有http://的浏览器请求都将保留该方式。 I have been modifying the .htaccess in the f3 folder according to the following:
我一直在根据以下内容修改f3文件夹中的.htaccess:
How to redirect all HTTP requests to HTTPS 如何将所有HTTP请求重定向到HTTPS
And, it's not working at all. 而且,它根本不起作用。
You need to use .htaccess in your public_html or "root" that is publicly accessible in order to modify for http redirect to https. 您需要在可公开访问的public_html或“ root”中使用.htaccess,以便将http重定向到https进行修改。
Something like this: 像这样:
RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com*$ [NC]
RewriteRule ^$ https://example.com%{REQUEST_URI} [R,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.