Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The rule should be (to remove the extra city, which is the GET parameter name):</p> <pre><code>'&lt;controller:\w+&gt;/&lt;action:\w+&gt;/&lt;city:\w+&gt;'=&gt;'&lt;controller&gt;/&lt;action&gt;', // not city:\d, since Delhi is a string, not digit </code></pre> <p>So the rule should be able to match the parameter name, incase you had foo/Delhi, you'd use <code>&lt;foo:\w+&gt;</code>.</p> <p>And to remove the <code>?</code> use <a href="http://www.yiiframework.com/doc/api/1.1/CUrlManager#appendParams-detail" rel="noreferrer" title="http://www.yiiframework.com/doc/api/1.1/CUrlManager#appendParams-detail"><code>appendParams</code> of <code>CUrlManager</code></a>, (in your <code>urlManager</code> config):</p> <pre><code>'urlManager'=&gt;array( 'urlFormat'=&gt;'path', 'appendParams'=&gt;true, // ... more properties ... 'rules'=&gt;array( '&lt;controller:\w+&gt;/&lt;action:\w+&gt;/&lt;city:\w+&gt;'=&gt;'&lt;controller&gt;/&lt;action&gt;', // ... more rules ... ) ) </code></pre> <p>When <code>appendParams</code> </p> <blockquote> <p>is true, GET parameters will be appended to the path info and separate from each other using slashes.</p> </blockquote> <hr> <p>Update: Incase you have more than one parameter being passed to the action i.e:</p> <pre><code>http://localhost/nbnd/search/manualsearch/Delhi?tosearch=restaurants </code></pre> <p>Use a <code>/*</code> at the end of the rule:</p> <pre><code>'&lt;controller:\w+&gt;/&lt;action:\w+&gt;/&lt;city:\w+&gt;/*'=&gt;'&lt;controller&gt;/&lt;action&gt;' </code></pre> <p>To get urls of form:</p> <pre><code>http://localhost/nbnd/search/manualsearch/Delhi/tosearch/restaurants </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload