简体   繁体   中英

Yii url rewriting removing index.php

I am trying to make the url rewriting and i want to remove index.php and I have done some research and found the online documentation aswell.

Here is what i did so far i uncomnted my main.php urlmaneger and i have the following

'urlManager'=>array(
            'urlFormat'=>'path',
            'showScripName'=>false,
            'rules'=>array(
                '<controller:\w+>/<id:\d+>'=>'<controller>/view',
                '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
                '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
            ),
        ),

and i have .htaccess which is loacted in my yiiApplication

RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php

Now when I launch the application it gives me the following error.

**Property "CUrlManager.showScripName" is not defined.**

How do I fix this?I do have my Rewrite engine on and also i have no errors on my php log or wamp server log.

Should I rewrite all of my urls inside of my project?

Rename to showScriptName , because you mistyped property name.

It should be:

'urlManager'=>array(
        'urlFormat'=>'path',
        'showScriptName'=>false,
        'rules'=>array(
            '<controller:\w+>/<id:\d+>'=>'<controller>/view',
            '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
            '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
        ),
    ),

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM