gpt4 book ai didi

php - Concrete5 在系统页面上强制使用 SSL

转载 作者:太空宇宙 更新时间:2023-11-03 13:41:10 24 4
gpt4 key购买 nike

我正在使用 Force SSL 插件并且需要使我的登录页面具有 SSL。我不希望其他页面有 SSL。在哪里为强制 SSL 插件启用此功能?

我还尝试将以下内容编程到登录模板中,但它会导致重定向循环,即使我还在/config/site.php 中放置了 define('REDIRECT_TO_BASE_URL', false):

$redirect= "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
header("Location:$redirect");

我还尝试将以下内容放入 .htaccess,但导致找不到页面:

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} login
RewriteRule ^(.*)$https://www.peacefulschools.com/login/$1 [R,L]

我当前的 .htaccess:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^peacefulschools\.net$ [OR]
RewriteCond %{HTTP_HOST} ^www\.peacefulschools\.net$
RewriteRule ^/?$ "http\:\/\/peacefulschools\.com\/" [R=301,L]


# Use PHP54 Single php.ini as default
AddHandler application/x-httpd-php54s .php

# -- concrete5 urls start --
<IfModule mod_rewrite.c>
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
</IfModule>
# -- concrete5 urls end --

无论是否使用插件,如何在登录页面的 URL 中获取 https?

最佳答案

如果您不使用插件或通过 php,您应该可以在 htaccess 中执行此操作。看看这是否适合您。

RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !^on$
RewriteCond %{REQUEST_URI} ^/login
RewriteRule ^(.*)$ https://www.peacefulschools.com/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^peacefulschools\.net$ [OR]
RewriteCond %{HTTP_HOST} ^www\.peacefulschools\.net$
RewriteRule ^/?$ http://www.peacefulschools.com/ [R=301,L]


# Use PHP54 Single php.ini as default
AddHandler application/x-httpd-php54s .php

# -- concrete5 urls start --
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
# -- concrete5 urls end --

关于php - Concrete5 在系统页面上强制使用 SSL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22056781/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com