Yii Framework Forum: How to make clean URLs in Yii2 framework using .htaccess?How to make clean URLs in Yii2 framework using .htaccess? - Yii Framework Forum

Jump to content

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

How to make clean URLs in Yii2 framework using .htaccess?How to make clean URLs in Yii2 framework using .htaccess? How to make clean URLs in Yii2 framework using .htaccess? Rate Topic: -----

#1 User is offline   alson 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 17-November 16

Posted 17 November 2016 - 03:06 AM

Hi there,

I've website hosted in asphostportal and I am trying make clean url for my website developed using Yii2 framework using .htaccess only. I know that i can use urlmanager class of Yii2. But due to some specific reasons I can't use it and wanted make clean url using .htaccess only.

I wanted to convert the following url: Url = localhost:8090/index.php?r=site%2Fcontact' To Url = 'localhost:8090/contact'

Thanks in advance.
0

#2 User is offline   katz 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 17-June 11

Posted 02 December 2016 - 03:06 AM

View Postalson, on 17 November 2016 - 03:06 AM, said:

Hi there,

I've website hosted in asphostportal and I am trying make clean url for my website developed using Yii2 framework using .htaccess only. I know that i can use urlmanager class of Yii2. But due to some specific reasons I can't use it and wanted make clean url using .htaccess only.

I wanted to convert the following url: Url = localhost:8090/index.php?r=site%2Fcontact' To Url = 'localhost:8090/contact'

Thanks in advance.


Actually, you have to use both urlmanager and htaccess (if you're using apache) to have clean url
0

#3 User is offline   djiwie 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 12-December 16
  • Location:Netherlands

Posted 25 January 2017 - 05:47 AM

If you really can't use UrlManager, you can rewrite your URL's in your .htaccess file to the actual request for Yii. But you also have to create all URLs within your application manually, as Yii cannot figure out what would be the correct URL. As such, you're really missing a lot of useful features from Yii.

Why is UrlManager not usable in your case?
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