url manager

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(....

http://www.yiiframework.com/doc/api/1.1/CUrlManager/#useStrictParsing-detail

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

There should a full alias such as site/index at the right part of URL rule.

still get redirected, with site.com/index.php?page=137 and without ?page=137. need to be, 404 …

Yii shouldn’t redirect you in this case. Check SiteController::actionIndex.


public function actionIndex()

    {

        return app()->request->redirect($this->createUrl('search/index'));

    }

??? :mellow:

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()

Well, the answer is in the error message ;)