Url Managment In Wamp

Hi Guys,

I have been using Url managment in my windows set up running apache under WAMP. I have never had a problem and everythings is working fine. However, I found out that thet applicaion.log in my runtime folder is getting bigger and bigger, and here is the message I usually got,




2013/04/20 18:50:42 [error] [exception.CHttpException.404] exception 'CHttpException' with message 'The system is unable to find the requested action "undefined".' in C:\wamp\yii\framework\web\CController.php:484

Stack trace:

#0 C:\wamp\yii\framework\web\CController.php(271): CController->missingAction('undefined')

#1 C:\wamp\yii\framework\web\CWebApplication.php(283): CController->run('undefined')

#2 C:\wamp\yii\framework\web\CWebApplication.php(142): CWebApplication->runController('site/undefined')

#3 C:\wamp\yii\framework\base\CApplication.php(162): CWebApplication->processRequest()

#4 C:\wamp\www\index.php(27): CApplication->run()

#5 {main}

REQUEST_URI=/site/undefined

HTTP_REFERER=http://localhost/site/index

---


2013/04/20 19:06:03 [error] [exception.CHttpException.404] exception 'CHttpException' with message 'Unable to resolve the request "undefined".' in C:\wamp\yii\framework\web\CWebApplication.php:287

Stack trace:

#0 C:\wamp\yii\framework\web\CWebApplication.php(142): CWebApplication->runController('undefined')

#1 C:\wamp\yii\framework\base\CApplication.php(162): CWebApplication->processRequest()

#2 C:\wamp\www\index.php(27): CApplication->run()

#3 {main}

REQUEST_URI=/undefined

HTTP_REFERER=http://localhost/


2013/04/20 19:06:41 [error] [exception.CHttpException.404] exception 'CHttpException' with message 'The requested view "undefined" was not found.' in C:\wamp\yii\framework\web\actions\CViewAction.php:113

Stack trace:

#0 C:\wamp\yii\framework\web\actions\CViewAction.php(124): CViewAction->resolveView('undefined')

#1 C:\wamp\yii\framework\web\actions\CAction.php(75): CViewAction->run()

#2 C:\wamp\yii\framework\web\CController.php(309): CAction->runWithParams(Array)

#3 C:\wamp\yii\framework\web\CController.php(287): CController->runAction(Object(CViewAction))

#4 C:\wamp\yii\framework\web\CController.php(266): CController->runActionWithFilters(Object(CViewAction), Array)

#5 C:\wamp\yii\framework\web\CWebApplication.php(283): CController->run('page')

#6 C:\wamp\yii\framework\web\CWebApplication.php(142): CWebApplication->runController('site/page/view/...')

#7 C:\wamp\yii\framework\base\CApplication.php(162): CWebApplication->processRequest()

#8 C:\wamp\www\index.php(27): CApplication->run()

#9 {main}

REQUEST_URI=/site/page/view/undefined

HTTP_REFERER=http://localhost/site/page/view/about

---


---






Almost all of the REQUEST_URI returns and undefined parameter. Again, I insist that eveything on the website is working and the urls are working but I get this CHttpException in my log file.

  • I make sure that engine rewrite was enabled in my apache installation
  • have a propoer .htacess (see below)
  • have a very simple urlmanager (see below)

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

And here is from my main config:





'urlManager'=>array(

		'urlFormat'=>'path',

		'showScriptName'=>false,

		'rules'=>array(

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

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

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

			),

		),

You see no matter which link I click the last parameter is undefined, gives exception but works. I really appreciate your help, I’m not new, but I can’t solve this.

Hohooooo I found the problem.

There was a webpage that a guy had the same problem, but on php and not yii. One of the solution was checking his CSS to see if there is a broken link to an image.

I checked my main layout and find out this buggy javascript function causes that error:




 $(".shortcuts").each(function(){

  	var cacheImage = document.createElement('img');

  	cacheImage.src = $(this).attr('rel');

  	cache.push(cacheImage);

	});



It was suppose to preload shortcuts images on the bootstrap navbar. so that fixed the problem