English 中文(简体)
仅使用 SYMFONY 的 HTPS 强制 HTPS 控制
原标题:Force HTTPS using only HTACCESS in SYMFONY

我们有一个1.4个Symfony项目, 并正在使用 htaccess 文件来强制 HTTPS 在一个 Symfony 应用程序中的所有页面 。 我知道有些方法可以使用过滤器, 但是我想知道, 没有第一个程序, HTTPS 是否可行?

这是我目前使用的... HHACCESS 文档,但效果不如预期...

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteCond %{REQUEST_FILENAME} !-f

我也曾尝试过,但没有成功:

RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

我肯定在和Symfony做这件事时我错过了一些怪事,因为这很容易马上做。有什么想法吗?

最佳回答

关于前一个回答 ,请尝试:

RewriteCond %{SERVER_PORT} !^443$
RewriteRule .? https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
问题回答

暂无回答




相关问题
How should I use https in Ruby on Rails

I m developing an application in Rails (2.3.4) and there are some parts that need to run over a secure protocol, for example, the login form, the credit card form, etc. How can I do just these pages ...

How to open a stream to httpS URL

I want to open a stream to a httpS URL and read the data. Kindly let me know how to do it. Regards Chaitanya

direct http to https on certain pages?

Hi I have added the below code to .ht access but how can I add another page to this? such as login.php also if the user types in www. they get a "untrusted connection" as the SSL is only valid ...

See what content is not sent over HTTPS

I created a page that is HTTPS only. On my browsers, I always get a warning that the page includes resources that are not secured. I just can t find out why! Looking at the source code seems fine. All ...

C# maintaining session over HTTPS on the client

I need to login to a website and perform an action. The website is REST based so I can easily login by doing this (the login info is included as a querystring on the URL, so I dont t need to set the ...

热门标签