urlmanager and pagination problem

Hi All!

I have a problem when i’m trying to enable urlmanager with “controller/admin”, the first page show correctly.

When i click to view second page a pop-up appear with this error code:


Error 404: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

<html><head>

<title>404 Not Found</title>

</head><body>

<h1>Not Found</h1>

<p>The requested URL /localhost/archivos/admin/archivos/admin//Archivos_page/2 was not found on this server.</p>

<hr>

<address>Apache/2.2.3 (Debian) PHP/5.2.0-8+etch11 Server at localhost Port 80</address>

</body></html>

My config/main.php




		'urlManager'=>array(

			'urlFormat'=>'path',

			'rules'=>array(

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

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

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

			),

			'showScriptName'=>false,

			//'appendParams'=>false

		),

My Controller.php created with gii:


public function actionAdmin()

	{

		$model=new Archivos('search');

		$model->unsetAttributes();  // clear any default values

		if(isset($_GET['Archivos']))

			$model->attributes=$_GET['Archivos'];


		$this->render('admin',array(

			'model'=>$model,

		));

	}

.htaccess:


RewriteEngine on


# if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f


<FilesMatch "^\.(ht)|\.(pdf)$|(\.*~)$">

  Order Allow,Deny

  Deny from all

</FilesMatch>


# otherwise forward it to index.php

RewriteCond $1 !^(index\.php)

RewriteRule ^(.+)$ index.php?$1 [PT,L,QSA]

it only happens if i enable the urlmanager, but i really need it.

Sorry for my english! :)

Please help!

Thanks

Hi Cobra, welcome to the forum.

I’m not sure, but what about this?




'rules'=>array(

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

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

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

),



The rules should be set in the order of "specific to general".

And, is your "archivos" controller in some module? If so, then you would need to add the rules for those actions in the modules.

"archivos" is just a Controller generated with Gii modified to do some things but nothing special.

Changed the rules as you said but still not working.

Again sorry for my english. I dont like to use google translate

Thanks!

Ah, OK. I could reproduce your problem with your settings.

I think the problem is in your .htaccess.

Would you please try to modify your .htaccess like this?




<FilesMatch "^\.(ht)|\.(pdf)$|(\.*~)$">

  Order Allow,Deny

  Deny from all

</FilesMatch>


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



This is from the guide

http://www.yiiframework.com/doc/guide/1.1/en/quickstart.apache-nginx-config

It may not satisfy all of your needs, but it should work for the current problem. I think you can start with this and add something that you want.

Never worry. I did understand what you wrote. :D

Thanks for the quick response.

As soon as I can, I’ll try that.

It works!!! Thank you!!!! :D

Sorry for the late response.