Url Manager-Result Page"not Founf"

Hi there.

I wanted to change the application URL Address because of selecting language option for end-users. I enable the apache rewrite module, creating a .htaccess file in the main application root for rewrite engine, add these rules in config/mani.php:


'urlManager' => array(

        	'class' => 'CTUrlManager',

        	'urlFormat' => 'path',

        	'showScriptName' => false,

        	'caseSensitive' => FALSE,

        	'appendParams' => true,

        	'cacheID' => 'cache',

        	'urlSuffix' => '.html',

        	'rules' => array(

            	'<language:(en|fa)>/<_c>/<_a>/*' => '<_c>/<_a>/',

            	'<language:(en|fa)>/<_m>/<_c>/<_a>/*' => '<_m>/<_c>/<_a>/',

        	),

    	),

Creating CTUrlManager class extends CUrlManager for overriding createUrl method.

Now, When i click a link which created by createUrl() the browser bring the page "Not Found", But if the urlManager that set in the config/main.php is commented, everything is ok and it work very well in the common url format.

yohooooooooooooooooo.

Nobody know?!:huh:

A more concrete example would be nice (such as an URL that does not resolve).

A possible reason could be, that your second rule will never match an URL. Say you are calling en/forum/topic/view/id/3. You expect it to resolve to

Module ID: forum

Controller ID: topic

Action ID: view

In fact, the URL will be catched by your first rule (because of your wildcard) and would resolve to

Controller ID: forum

Action ID: topic

which would rise an HttpException (unless you defined that controller with that action)

Hi,

Post your CTUrlManager class

for example in this format rule, which query url should i have?


'urlManager'=>array(

      	'urlFormat'=>'path',

      	'rules'=>array(

      	'<controller:\w+>/<id:\d+>'=>'<controller>/view',

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

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

      	),

      	),

this is the file:4573

CTUrlManager.php

Hi again

you should rules as you post in the first time


'<language:(en|fa)>/<_c>/<_a>/*' => '<_c>/<_a>/',

'<language:(en|fa)>/<_m>/<_c>/<_a>/*' => '<_m>/<_c>/<_a>/',



also what is the generated url by createUrl that browser display ‘Not Found’ , in which cases? (give us example)

Note:


if (!defined('YII_PATH')) exit('No direct script access allowed!'); 

I think, this is not necessary, htaccess in protected file protects your php file from directly access :)