About Prettyurl's Question

In main.php, I set UrlManager:

‘urlManager’ => [

‘enablePrettyUrl’ => true,

‘showScriptName’ => false,

‘suffix’ => ‘.htm’,

]

and i can use /site/index.htm to access the website.

And i cannot use /index.php?r=site/index.

But I want use both. Because i use it in js file early.

Can someone help me…

Thanks.


我能同时用这两种Url形式来访问吗?比如配置Nginx的Rewrite规则.

I think you can use site/index ( or just index if you are already in the site controller) in your js file

not /index.php?r=site/index

do you have a code sample?