Yii Framework Forum: Tricky URL rewrite - Yii Framework Forum

Jump to content

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

Tricky URL rewrite Rate Topic: -----

#1 User is offline   imehesz 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 714
  • Joined: 13-June 09
  • Location:Jacksonville, FL

Posted 20 July 2010 - 12:43 PM

Hello everyone,

I have the following rewrite rule set up in my main.php configuration file:

...
'rules'=>array(
  '/<slug:[A-Z]+>' => 'url/redirect',
  '<controller:\w+>/<id:\d+>'=>'<controller>/view',
  '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
  '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
...


so it means, that all the requests that come in as: exmple.com/AABC(etc), get sent to my Url controller, redirect action.

It actually works perfectly, as long as I have showScriptName=true. (but my links have the "ugly" index.php in the Url :/ )

How can I use showScriptName=false, and keep my rewrite rule ...

thanks,
--iM
It’s done, the great act of creation.
The maker rests. The wheel’s in motion.
-- Imre Madách

check out Yii Theme Factory at http://yii.themefactory.net
0

#2 User is offline   Mike 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 3,017
  • Joined: 06-October 08
  • Location:Upper Palatinate

Posted 21 July 2010 - 02:08 AM

Hmm, it should work the same with showScriptName=false. What happens if you disable it?

Oh, and maybe try to leave away the '/..' on the first rule and add a separate '/' rule for your start page. Other than that i don't see, why it shouldn't work without index.php.
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