Cakephp安全组件Forcessl与重写规则冲突
我正在使用安全组件forcessl在整个网站上强制使用https 对于https://www.domain.com/pages/detail/terms,在.htaccess文件中,我重写规则如下Cakephp安全组件Forcessl与重写规则冲突,php,.htaccess,cakephp,Php,.htaccess,Cakephp,我正在使用安全组件forcessl在整个网站上强制使用https 对于https://www.domain.com/pages/detail/terms,在.htaccess文件中,我重写规则如下 RewriteRule ^(terms)$ pages/detail/$1/ [L] 因此,它应该重定向到https://www.domain.com/terms 当使用https://domain.com/terms访问术语页面时,它将重定向到 使用访问术语页面时,它将重定向到https://ww
RewriteRule ^(terms)$ pages/detail/$1/ [L]
因此,它应该重定向到https://www.domain.com/terms
当使用https://domain.com/terms访问术语页面时,它将重定向到
使用访问术语页面时,它将重定向到https://www.domain.com/pages/detail/terms
这是因为控制器中的forcessl:
$this->redirect('https://' . $_SERVER['SERVER_NAME'] . $this->here);
$this->here
指向原始页面(页面/详细信息/术语)。如何解决这个问题 您尝试过使用Cake PHP的路由函数吗?在
config/routes.php
中添加以下内容:
Router::connect(
'/terms',
array(
'controller' => 'pages',
'action' => 'detail',
'terms'
)
);
不,我现在试过了,但运气不好。Forcessl函数将当前请求重定向到https,url转到domain.com/pages/detail/terms。