S
S
skijaev2015-06-17 13:16:38
Yii
skijaev, 2015-06-17 13:16:38

Why doesn't redirect work in Yii when index.php is outside the project folder?

The Yii project is located in the site.com/SiteCore
folder. There, inside this folder, there is protected, yii itself, and other files.
At the same time, the index.php file is not in site.com/SiteCore , but in site.com , and everything is written in it way so

<?php
// change the following paths if necessary
$yii=dirname(__FILE__).'/SiteCore/yii/framework/yii.php';
$config=dirname(__FILE__).'/SiteCore/protected/config/main.php';
// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
require_once($yii);
Yii::createWebApplication($config)->run();
?>

As a result, the site works fine, but if you write a redirect in the view controller
$this->redirect(" mail.ru ");
or
Header("Location: mail.ru ");
Then they don't work.
With what it can be connected?
PS when the index was in the SiteCore folder, the redirect worked

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
skijaev, 2015-06-17
@skijaev

I found the joint myself, it was in a banal gap.
Cut off this case right away, since it worked in the SiteCore folder. But it turned out that the space was in the index itself at the beginning, this is how the FTP client added when editing ....

S
Stalker_RED, 2015-06-17
@Stalker_RED

Check which headers are coming to the browser.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question