Yii Framework Forum: url manager - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

url manager Rate Topic: -----

#1 User is offline   kel 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 23-October 11

Posted 25 October 2011 - 04:43 AM

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

0

#2 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,778
  • Joined: 17-January 09
  • Location:Russia

Posted 25 October 2011 - 07:16 AM

http://www.yiiframew...tParsing-detail
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#3 User is offline   kel 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 23-October 11

Posted 25 October 2011 - 07:54 AM

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
0

#4 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,778
  • Joined: 17-January 09
  • Location:Russia

Posted 26 October 2011 - 05:49 AM

There should a full alias such as site/index at the right part of URL rule.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#5 User is offline   kel 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 23-October 11

Posted 26 October 2011 - 06:35 AM

View Postsamdark, on 26 October 2011 - 05:49 AM, said:

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

#6 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,778
  • Joined: 17-January 09
  • Location:Russia

Posted 26 October 2011 - 09:08 AM

Yii shouldn't redirect you in this case. Check SiteController::actionIndex.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#7 User is offline   kel 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 23-October 11

Posted 26 October 2011 - 11:08 AM

View Postsamdark, on 26 October 2011 - 09:08 AM, said:

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



public function actionIndex()
    {
        return app()->request->redirect($this->createUrl('search/index'));
    }



??? :mellow:
0

#8 User is offline   kel 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 23-October 11

Posted 26 October 2011 - 11:59 AM

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

0

#9 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,778
  • Joined: 17-January 09
  • Location:Russia

Posted 26 October 2011 - 12:38 PM

Well, the answer is in the error message ;)
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users