kelevra83
(Kelevra1983)
October 25, 2011, 9:43am
1
Hello, there is a problem. the site Home Page is available at several locations,
site.com/
site.com/index.php?page=137
site.com/?index.php?page=137
and other similar. in curlmanager enabled path.
how to disable the QueryString, which would be on these links was 404?
'urlManager' => array(
'urlFormat' => 'path',
'showScriptName' => false,
'rules' => array(....
samdark
(Alexander Makarov)
October 25, 2011, 12:16pm
2
kelevra83
(Kelevra1983)
October 25, 2011, 12:54pm
3
tried to include but not be able to pick up rule for the main page
if
'/' => '/'
obtained the same result
if
'/' => 'site'
triggered a redirect to site.com/search/index , but I do not have a redirect, I need 404. and even if you type site.com/index.php?page=137 or site.com same redirect to site.com/search/index
samdark
(Alexander Makarov)
October 26, 2011, 10:49am
4
There should a full alias such as site/index at the right part of URL rule.
kelevra83
(Kelevra1983)
October 26, 2011, 11:35am
5
still get redirected, with site.com/index.php?page=137 and without ?page=137. need to be, 404 …
samdark
(Alexander Makarov)
October 26, 2011, 2:08pm
6
Yii shouldn’t redirect you in this case. Check SiteController::actionIndex.
kelevra83
(Kelevra1983)
October 26, 2011, 4:08pm
7
public function actionIndex()
{
return app()->request->redirect($this->createUrl('search/index'));
}
kelevra83
(Kelevra1983)
October 26, 2011, 4:59pm
8
if use
public function actionIndex()
{
// renders the view file 'protected/views/site/index.php'
// using the default layout 'protected/views/layouts/main.php'
$this->render('index');
}
get an error
exception 'CException' with message 'SiteController cannot find the
requested view "index".' in
Z:\home\mov.tu\www\framework\web\CController.php:843
Stack trace:
#0 Z:\home\mov.tu\www\framework\web\CController.php(747):
CController->renderPartial('index', Array, true)
#1 Z:\home\mov.tu\www\protected\components\BaseController.php(580):
CController->render('index', Array, false)
#2 Z:\home\mov.tu\www\protected\controllers\SiteController.php(43):
BaseController->render('index')
#3 Z:\home\mov.tu\www\framework\web\actions\CInlineAction.php(57):
SiteController->actionIndex()
#4 Z:\home\mov.tu\www\framework\web\CController.php(300):
CInlineAction->run()
#5 Z:\home\mov.tu\www\framework\web\CController.php(278):
CController->runAction(Object(CInlineAction))
#6 Z:\home\mov.tu\www\framework\web\CController.php(257):
CController->runActionWithFilters(Object(CInlineAction), Array)
#7 Z:\home\mov.tu\www\framework\web\CWebApplication.php(328):
CController->run('')
#8 Z:\home\mov.tu\www\framework\web\CWebApplication.php(121):
CWebApplication->runController('site')
#9 Z:\home\mov.tu\www\framework\base\CApplication.php(155):
CWebApplication->processRequest()
#10 Z:\home\mov.tu\www\index.php(54): CApplication->run()
samdark
(Alexander Makarov)
October 26, 2011, 5:38pm
9
Well, the answer is in the error message