有没有办法在标题中提到?目前,无论我们输入http://www.url.com
,所有网址请求都会转到https://www.url.com我的代码是Bootstrap.php是:
class Core_Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initDoctype()
{
$this->bootstrap('view');
$view = $this->getResource('view');
$view->addHelperPath(APPLICATION_PATH . '/modules/core/views/helpers','Core_View_Helper');
//$view->controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
$view->doctype('XHTML1_TRANSITIONAL');
// setting content type and character set
$view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8')
->appendHttpEquiv('X-UA-Compatible', 'IE=7')
->appendHttpEquiv('X-UA-Compatible', 'IE=EmulateIE7');
$frontend= array(
'lifetime' => 7200,
'automatic_serialization' => true
);
$backend= array(
'cache_dir' => APPLICATION_PATH . '/../data/cache',
);
$cache = Zend_Cache::factory(
'core',
'File',
$frontend,
$backend
);
Zend_Registry::set('cache',$cache);
}
protected function _initRoutes()
{
$this->bootstrap('FrontController');
$front = $this->getResource('FrontController');
$router = $front->getRouter();
$route['page'] = new Zend_Controller_Router_Route_Regex(
'([^\.]+)\.html',
array(
'module' => 'cms',
'controller' => 'page',
'action' => 'view'
)
);
$router->addRoute('page', $route['page']);
}
}
用于重定向的htaccess是无用的,因为它会创建一个间接循环。似乎所有带https的网址都会被重定向到http。有办法阻止这个吗?
答案 0 :(得分:0)
尝试更新.htaccess
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yoursite.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ public/index.php [NC,L]
请注意,应用程序的根目录中只应有一个htaccess。 检查您的公用文件夹并删除.htaccess(如果有)