Background:
I have opened the URL beautification, here is the current URL rule
Url:
Example.com/site/view?id=06xbvouytbve9ph8t%2fkjg%3d%3d
Where the value of the parameter ID is encrypted
To become this URL:
1, example.com/view/06xbvouytbve9ph8t%2fkjg%3d%3d.html
But no matter how they are configured,
But this is possible:
2, example.com/view/1199.html
2 of these routing rules are well-equipped:
rules => [ 'view/
' => 'site/view' // 好使]
But 1 of the routing rules are not good enough to make:
rules => [ 'view/
' => 'site/view' // 不行 'view/
' => 'site/view' // 不行 'view/
' => 'site/view' // 不行 '/view/
.html'=>'site/view?id=
' // 不行]
Does the rules rule only support \d?
How to configure to have 1 this effect?
Online, etc.
Reply content:
Background:
I have opened the URL beautification, here is the current URL rule
Url:
Example.com/site/view?id=06xbvouytbve9ph8t%2fkjg%3d%3d
Where the value of the parameter ID is encrypted
To become this URL:
1, example.com/view/06xbvouytbve9ph8t%2fkjg%3d%3d.html
But no matter how they are configured,
But this is possible:
2, example.com/view/1199.html
2 of these routing rules are well-equipped:
rules => [ 'view/
' => 'site/view' // 好使]
But 1 of the routing rules are not good enough to make:
rules => [ 'view/
' => 'site/view' // 不行 'view/
' => 'site/view' // 不行 'view/
' => 'site/view' // 不行 '/view/
.html'=>'site/view?id=
' // 不行]
Does the rules rule only support \d?
How to configure to have 1 this effect?
Online, etc.
The upstairs answer makes sense, the appearance%2f means the URL becomes/view/06xbvouytbve9ph8t/fkjg%3d%3d.html, therefore inevitably cannot match/view/ this kind of format.
In addition, the program is very rude to say that it is fooling ghosts. What is the purpose of the friendly URL? Improve readability, help SEO, an unknown so-called encryption string has this role? Is there any difference between the id= and the previously not optimized direct? It's just a formality.
The positive solution is to use the slug field, such as/view/iphone-6s-gold, which is the real optimization.
Do not say that is to prevent other people lose the ID ah, it is untenable, do not want to write more reasons. And the slug solution also solves the problem.
I think,%2f will be treated as/to deal with the ID of the decryption function to outsource a layer, the%2F special processing (such as setting a placeholder instead).
The question is whether 1 or 2.
The title is 2, the content feeling is 1
example.com/view/06XBvOuYTbVE9pH8t%2FKJg%3D%3D.htmlarray( '/view/
.html'=>'site/view?id=
')