Background: I have enabled url Beautification. The following is the current url rule URL: example. comsiteview? Id06XBvOuYTbVE9pH8t % 2 FKJg % 3D % 3D where the parameter id value is encrypted and you want to change it to this url: 1. example. comview06XBvOuYTbVE9pH8t % 2 FKJg % 3D % 3D. h... background:
I have enabled url Beautification. The following are the current url rules.
URL:
Example.com/site/view? Id = 06XBvOuYTbVE9pH8t % 2 FKJg % 3D % 3D
The value of the parameter id is encrypted.
To change to this url:
1. example.com/view/06XBvOuYTbVE9pH8t%2FKJg%3D%3D.html
However, no matter how configured,
However, this is acceptable:
2. example.com/view/1199.html
The routing rules of 2 are well configured:
Rules => ['view/
'=> 'Site/view' // Easy to use]
However, the configuration of the 1 route rule is not good:
Rules => ['view/
'=> 'Site/view' // no 'View/
'=> 'Site/view' // no 'View/
'=> 'Site/view' // No'/view/
. Html '=> 'site/view? Id =
'// No]
Does the rules rule only support the \ d regular expression?
How can I configure it to achieve the effect of 1?
Online
Reply content:
Background:
I have enabled url Beautification. The following are the current url rules.
URL:
Example.com/site/view? Id = 06XBvOuYTbVE9pH8t % 2 FKJg % 3D % 3D
The value of the parameter id is encrypted.
To change to this url:
1. example.com/view/06XBvOuYTbVE9pH8t%2FKJg%3D%3D.html
However, no matter how configured,
However, this is acceptable:
2. example.com/view/1199.html
The routing rules of 2 are well configured:
Rules => ['view/
'=> 'Site/view' // Easy to use]
However, the configuration of the 1 route rule is not good:
Rules => ['view/
'=> 'Site/view' // no 'View/
'=> 'Site/view' // no 'View/
'=> 'Site/view' // No'/view/
. Html '=> 'site/view? Id =
'// No]
Does the rules rule only support the \ d regular expression?
How can I configure it to achieve the effect of 1?
Online
The answer upstairs makes sense. If % 2F appears, it means that the url is/view/06XBvOuYTbVE9pH8t/fkjg1_3d1_3d.html, so it cannot match/view/ This format is used.
In addition, this solution is just a fool. What is the purpose of Friendly URL? Improve readability and help SEO. does an unknown encrypted string play this role? Is it direct to the previous optimization? Is there any difference in id =? It's just a form. interesting?
The positive solution is to use slug fields such as/view/iphone-6s-gold, which is truly optimized.
Don't say it is to prevent others from losing their IDs. this is untenable and you don't want to write more reasons. The slug solution also solves this problem.
In my opinion, % 2F will be treated as/. you can outsource a layer of id encryption and decryption functions and perform special processing on % 2F (such as setting a placeholder instead ).
Whether it is question 1 or question 2.
Title is 2, content is 1
example.com/view/06XBvOuYTbVE9pH8t%2FKJg%3D%3D.htmlarray( '/view/
.html'=>'site/view?id=
')