Note that there are some explanatory texts on larger screens.

plurals
  1. POCakePHP controller alias
    primarykey
    data
    text
    <p>I know there are a couple of other topics about this subject, but non of them seems to fit my needs.</p> <p><strong>What I have</strong></p> <ul> <li>example.com/log/</li> <li>LogsController.php</li> </ul> <p>I have <code>LogsController</code> instead of <code>LogController</code> (plural) because CakePHP wants you to have controllers in plural.</p> <p>But as you might know/notice, <code>example.com/log/</code> will never use <code>LogsController</code> because of the missing 's' in the url.</p> <p>Now, I want to have <code>/log/*</code> being redirected to <code>/logs/*</code>. Works perfectly fine with the following code:</p> <pre><code>Router::connect ('/log/*', array('controller'=&gt;'logs')); </code></pre> <p>But, when I try to access <code>example.com/log/actions/foo/bar</code> it doesn't seem to work. So after some Googeling I found this:</p> <pre><code>Router::connect ('/log/:action/*', array('controller'=&gt;'logs')); </code></pre> <p>Works great. But now when I'm trying to access example.com/log/ again, it says</p> <blockquote> <p>Error: LogController could not be found.</p> </blockquote> <p><strong>Question</strong> So my question is, how do I set up an alias for my url so that <code>/log/</code> will use <code>LogsController</code> instead of trying to use <code>LogController</code>.</p> <p>I have a few more Controllers where I'd like to change this, like <code>flight =&gt; FlightsController</code>, <code>profile =&gt; ProfilesController</code>.</p> <hr> <p>Have a look at <a href="https://stackoverflow.com/questions/12874722/">this question</a>. It is about the same subject, but slightly different. It might help you in some way.</p>
    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