Yii Framework Forum: add exception to the friendly URLs - Yii Framework Forum

Jump to content

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

add exception to the friendly URLs

#1 User is offline   Tenbe 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 22-December 13

Posted 07 November 2017 - 04:33 PM

Hello everyone.
I have a site with Yii URL friendly enabled. It works perfectly like e.g. www.mydomain.com/category/view?id=1 when there is a controller CategoryController and a views/category/view.php file.

My proble isthat I want to add my own friendly url like e.g. www.mydomain.com/ownurl/1/ and point it to the url www.mydomain.com/category/view?id=1. The problem is that there is no OwnurlController and I don't want to add one such controller for each URL I add.

I am having trouble getting this work properly ini my .htaccess file.
Can someone please help with this?

Thanx
0

#2 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,824
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 07 November 2017 - 05:39 PM

URL rules may be a solution (perhaps parameterized with literal "category/view")
http://www.yiiframew....html#url-rules

I guess this also may be of interest
http://www.yiiframew...#creating-rules
Don't forget to read The Definitive Guide to Yii (1.1 en) (1.1 sv) (2.0 en) | The class reference (1.1) (2.0) has the details
0

#3 User is offline   Tenbe 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 22-December 13

Posted 11 November 2017 - 08:00 AM

I solved this by overwriting the runAction method in the Controller
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