Yii Framework Forum: Clean URL - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Clean URL IIS 6 Rate Topic: -----

#1 User is offline   Liz 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 61
  • Joined: 10-February 12

Posted 09 March 2012 - 12:03 PM

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
0

#2 User is offline   sensorario 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,986
  • Joined: 07-September 10
  • Location:Cesena (Italy)

Posted 09 March 2012 - 12:25 PM

Mmmm URL are an apache stuff.
0

#3 User is offline   phpnode 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 141
  • Joined: 18-April 11

Posted 09 March 2012 - 12:31 PM

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.co...ite-on-iis.aspx
0

#4 User is offline   Liz 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 61
  • Joined: 10-February 12

Posted 09 March 2012 - 02:26 PM

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',
					
				),

		),


Attached File(s)


0

#5 User is offline   phpnode 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 141
  • Joined: 18-April 11

Posted 09 March 2012 - 03:17 PM

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

#6 User is offline   Liz 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 61
  • Joined: 10-February 12

Posted 09 March 2012 - 03:20 PM

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 :)
0

#7 User is offline   Liz 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 61
  • Joined: 10-February 12

Posted 12 March 2012 - 11:48 AM

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?
0

#8 User is offline   Liz 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 61
  • Joined: 10-February 12

Posted 13 March 2012 - 09:39 AM

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
0

#9 User is offline   demo.ideaentity 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 02-May 12

Posted 31 May 2012 - 07:47 AM

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
0

#10 User is offline   Bynton 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 20
  • Joined: 09-July 12

Posted 17 July 2012 - 10:48 PM

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

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users