【问题标题】:Concrete5 Force SSL on system pagesConcrete5 在系统页面上强制 SSL
【发布时间】:2014-02-27 00:46:28
【问题描述】:

我正在使用 Force SSL 插件,需要使我的登录页面具有 SSL。我不希望其他页面有 SSL。在哪里为 force 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 ssl concrete5


    【解决方案1】:

    如果您不使用插件或通过 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 --
    

    【讨论】:

    • 它仍然没有显示,但我认为这是因为我在 .htaccess 中拥有的其他内容。我会把它添加到我的问题中。你怎么看?
    • 试试这个更新的 htaccess 看看它是否适合你。
    • 感谢您的回复!它仍然对我不起作用:(如果我输入peaceschools.com/login,它会重写为peacefulschools.com/index.php/login。我试图看看如果我删除“concrete5 urls start”cmets之间的所有重写条件会发生什么......然后它确实重定向到peacefulschools.com/login,但随后出现未找到bluehost页面的错误。想法?
    • 顺便说一句,我仍然安装了插件,因为它很容易在我们的电子商务页面上重定向到 https
    • 找不到页面,因为您的 URL 看起来应该是 https://www.peachfulschools.com/index.php/login 尝试在登录重定向规则之前添加 index.php
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多