Note that there are some explanatory texts on larger screens.

plurals
  1. POZend Regex > Route module problem
    primarykey
    data
    text
    <p>iam using zend framework to build a REST web service and i am using modules to separate my api versions, as i have mentioned <a href="https://stackoverflow.com/questions/5167757/zend-regex-route-track-the-api-version"><strong>here</strong></a></p> <p>Ex: "applications/modules/v1/controllers", "applications/modules/v2/controllers" have different set of actions and functionality. I have mentioned my default module as "v1" in my application.ini</p> <p>I am using context switching along with Regex Routing as i have mentioned <a href="https://stackoverflow.com/questions/5167757/zend-regex-route-track-the-api-version/5169605#5169605"><strong>here</strong></a> in my accepted solution:</p> <pre><code>$router-&gt;addRoute( 'route1', new Zend_Controller_Router_Route_Regex( 'api/([^-]*)/([^-]*)\.([^-]*)', array( 'controller' =&gt; 'index', 'action' =&gt; 'index'), array( 1 =&gt; 'module', 2 =&gt; 'controller', 3 =&gt; 'format' ) )); </code></pre> <p>This is my url: <a href="http://localhost/api/v1/tags.xml" rel="nofollow noreferrer">http://localhost/api/v1/tags.xml</a></p> <p>"v1" indicates module. Now, coming to context switching, if the url has v1, it is going to v1 module's TagsController. But if the module in url is v2, i am getting an error such as:</p> <blockquote> <p>The requested URL /pt/public/index.php/api/v2/tags.xml was not found on this server.</p> </blockquote> <p>I could not understand why its blowing up. Is it because i have put the default module as v1? I am not able to change the module based on the url.</p> <p><strong>And this is my directory tree:</strong></p> <ul> <li>application <ul> <li>modules <ul> <li>v1 <ul> <li>controllers <ul> <li>TagsController.php </li> </ul></li> </ul></li> <li>v2 <ul> <li>controllers <ul> <li>TagsController.php</li> </ul></li> </ul></li> </ul></li> </ul></li> <li>library</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    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