Problem with routing

Hello,

I have a problem with routing.

If I have controller called “group”, and in it is action “name”, my route it looks: “example.com/group/name/php-devotees/”. I’d to, my route was without action “name” in adress. (“example.com/group/php-devotees/”)

I tried to find a solution to my problem, but to no avail.

You should read about URL Management in the Definitive Guide to Yii.

/Tommy

You helped me again.

I had problem, because in config, were put default rules, and so them routing didn’t work :)

thanks

edit:

I have a one more problem. When I put in adress “index.php” all it’s ok, but when I don’t put it, appear error:

It’s my .htaccess configuration:

What’s going wrong?

Have you set showScriptName to false?

I’ve got true

My .htaccess is a bit different then yours

try it




RewriteEngine On

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^.*$ /index.php [L]



It’s worse :confused:

redirect me to lower level (../)

Ok, now I’ve read the whole post

just do in your config something like :




'urlManager'=>array(

        	'showScriptName'=>false,

        	'urlFormat'=>'path',

        	'rules'=>array(

    			'group/<title:\w+>'=>'group/name',

        	),

    	),



and its done

Still the same :(

use your old htaccess and

‘urlFormat’=>‘path’,

then try again

should work

Of course, I tried to use my old .htacces, and it doesn’t work :(

sorry I meant remove




'urlFormat'=>'path',



Still doesn’t work :confused:

edit:

I found solution.

First I gave in my .htaccess: (from docs)


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



Then in config:




'urlManager'=>array(

        	'urlFormat'=>'path',

        	'rules'=>array(

        		'group/<title:\w+>/'=>'group/name',

        		'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

        	),

        ),



It does work! :)

Thanks everybody :)