Z
Z
ZaurK2016-10-07 11:10:01
Yii
ZaurK, 2016-10-07 11:10:01

How to make pretty links in create/delete/edit commands in yii2?

Hello!
When navigating through the pages of the site using .htaccess and enablePrettyUrl, beautiful links of the type are configured http://backend.site.loc/catalog, but when you click on the post editing buttons, they continue to be displayed as http://backend.alf.loc/catalog/update?id=1. My question is, is this the norm or would it be more correct like this http://backend.alf.loc/catalog/update/1?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Fedorov, 2016-10-07
@ZaurK

The kind of links backend.alf.loc/catalog/update/1 are more convenient for the end user. In yii2, you can bring links to any desired form using UrlRule, you can read more about this here https://github.com/yiisoft/yii2/blob/master/docs/g...

H
HellWalk, 2017-08-02
@HellWalk

By the way, I'm surprised that the Gii bundled with Yii2 generates links exactly in the format:
site.ru/catalog/update?id=1
although it would be correct:
site.ru/catalog/update/1
Very strange, given that the code the generated Gii should be a role model.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question