Clean URL

Hi guys

I tried to have clean URL on mac with XAMPP and it works well.

I am trying to have clean url in IIS 6 on a windows machine? Does anyone have an idea?

Thank you

Mmmm URL are an apache stuff.

ignoring the fact that this is in totally the wrong sub forum. This isn’t a Yii issue, you just need to learn how to rewrite urls with IIS, http://blogs.msdn.com/b/dotnetinterop/archive/2008/06/18/rewriting-urls-on-iis5-iis6-or-iis7-mod-rewrite-on-iis.aspx

Thank you. I read that article but it does not say how to rewrite a rule.

I tried to do something like the attachment but it didnt help.

That’s what i have in config/main.php







'urlManager'=>array(

	'urlFormat'=>'path',

	'showScriptName'=>	false,

		'rules'=>array(

				'' => '/site/index',	

				'About' => array('site/page', 'defaultParams' => array('view' => 'about')),

				'Menu' => array('site/page', 'defaultParams' => array('view' => 'menu')),

				'Contact'=>'/site/contact',

				'List'=>'user/index',

				'Create'=>'user/create',

				'Manage'=>'user/admin',

				'login'=>'/site/login',

				'logout'=>'/site/logout',

					

				),


		),






it’s not something you can solve with PHP or Yii, you need to configure IIS correctly.

Thank you. I know it is not Yii issue but I was hoping someone had had the same problem and I can get help from him/her :)

I am able to use rewrite rules which directs me to a correct url but somehow the same urlManagr does not work in IIS for a windows machine/

For example




http://localhost/user/index.php?r=user/create



changes to




http://localhost/user/Create



and here is my urlManager




'urlManager'=>array(

			'urlFormat'=>'path',

			'showScriptName'=>	false,

			'rules'=>array(

					'' => '/site/index',	

					'About' => array('site/page', 'defaultParams' => array('view' => 'about')),

					'Menu' => array('site/page', 'defaultParams' => array('view' => 'menu')),

					'Contact'=>'/site/contact',

					'List'=>'user/index',

					'Create'=>'user/create',

					'Manage'=>'user/admin',

					'login'=>'/site/login',

					'logout'=>'/site/logout',

					

					),

		

),

				



any idea what when wrong?

Anyone knows why on a PC with XAMPP clean url does not work the same way it works on a mac? On a MAC I get a url as simple as




localhost/user/Create



but on a PC it gives me


localhost/user/index.php/Create



Any idea how to remove that index.php in the middle?

Thanks

This is my config

‘urlManager’=>array(

		'urlFormat'=>'path',


		'showScriptName'=>false,


                    'caseSensitive'=>false, 


                    


                    


                    'rules'=>array(


                            '' => '/site/index',


                            '<action:(index|page|contact|login)>'=>'site/<action>',


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


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


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


                            


            


		),


	),

.htaccess file

<IfModule mod_rewrite.c>

Enable mod_rewrite engine

RewriteEngine on

RewriteBase /sslprototype

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

RewriteRule site/(.*) /$1 [L,NS]

</IfModule>

I hope it solves your problem

It’s not seems like any problem with PHP or Yii. Something wrong with IIS, try to configure IIS correctly.