.htaccess - Yii url rewriting removing index.php

324

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?

297

Answer

Solution:

Rename toshowScriptName, 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>',
        ),
    ),

People are also looking for solutions to the problem: mysql - Undefined index: on uploading an image into database from php

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.