CakePHP controller alias not working fully

I have a new question related to this question , but since the questions do not coincide at all, I am creating this new topic. But this is a good recommendation.


I changed my mind regarding logsto log, logsokay. But I have another controller called WikisController, in which case I would really like to change the URL. I just hate what the URL will be example.com/wikis/subject.html, I want it to be example.com/wiki/subject.html. It is much cleaner, and the agreement now matches 100% with other sites where it is also called wiki, and not wikis. But I want the controller to be called WikisControllerdue to convention CakePHP.

Well, now the real problem arises. I am currently using the following routing in Config/routes.php:

Router::connect('/wiki/:action/*', array('controller' => 'wikis'));
Router::connect('/wiki/*', array('controller' => 'wikis'));

This is part of the code used by the solution in another topic . But now I have a problem. Well, this is not a very big problem, because everything is working fine. But I do not like the URL.

When I create a link somehow from example.com/wiki/edit.html:

echo $this->Html->link('Wiki overview', array(
    'controller' => 'wikis',
    'action' => 'index',
    'ext' => 'html'
));

It creates a link to example.com/wiki/index.htmlcompletely fine, and it works, but I don’t want to show index.html, I just don’t do it. This word is additional in the URL, and the user does not need to understand where it is.

link controller action - , . action, example.com/edit.html, , . action => index . , , . Index = index . , , URL- , action .

:

, , example.com/flights/index.html example.com/flights/add.html, /index URL- URL- example.com/flights.html, .

- , , .

+2
1

, , /wiki index:

Router::connect('/wiki', array('controller' => 'wikis', 'action' => 'index'));
Router::connect('/wiki/:action/*', array('controller' => 'wikis'));
...
+1

All Articles