Add slash "/" to URL

I have the following text

Car/red 

I want it to be sent with an address for example:

 http://ii/search/index/search/Car%2Fred/page/2 

but at the same time the query string β€œSearch” contains only the β€œcar” and ignores the β€œred” part, how can we encode the slash so that it can be sent to the URL?

+4
source share
1 answer

If you use the urlFormat path , you cannot send a slash to parameters, because Yii cannot distinguish between them. See the Qiang comment .

As a workaround:

 'urlManager'=>array( 'appendParams'=>false, ), 

Your URL should look like this:

http: // ii / search / index? search = Car / red & page = 2

You can also add rewrite rules so that the page URL is better in the URL.

+3
source

Source: https://habr.com/ru/post/1401565/


All Articles