Concrete5强制系统页面上的SSL

时间:2014-02-27 00:46:28

标签: php .htaccess ssl concrete5

我正在使用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?

1 个答案:

答案 0 :(得分:0)

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