josotoru
josotoru

Reputation: 77

Rewrite URL with id in Yii

I have an project made with Yii and I use a page with variable id.

My detail with id variable before update urlManager on config/main.php that was stopped.

I configured correctly the config/main.php like these lines:

'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>',
                '/'
            ),
        ),

In .htaccess

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

After done that parameters I have the follwing SEO-friendly url:

http://www.verinmuebles.co/permalink-id.html

Where id is a ID to get content related but I get an error 404 with this URL. What I do?

Thanks!

Upvotes: 0

Views: 87

Answers (1)

Samuel Liew
Samuel Liew

Reputation: 79042

'permalink-<id:\d+>.html'=>'page/view',

Upvotes: 1

Related Questions