Invalid urlmanager configuration in yii2

Source: Internet
Author: User
I wrote an interface using the path localhostapiwebindex. php? The code of rusertestactiontest is echo & #039; 123 & #039; according to the online tutorial, configure urlmanager. the code is as follows {code ...} then Configure nginx rewritelisten80; {code ...} sincerely... I wrote an interface using the path localhost/api/web/index. php? R = user/test
The code of actiontest is echo '123 ';
Configure urlmanager according to the tutorial on the internet. the code is as follows:

'Urlmanager' => ['enableprettyurl' => true, // beautify url = ture 'enablestrictparsing' => false, // strict parsing not enabled 'showscriptname' => false, // hide the index. php 'rules' => ['
  
   
/'=>'
   
    
/',],],
   
  

Then configure nginx rewrite

Listen 80;

Server_name localhost; location/{root D:/Github/Server/advanced; index. php index.html index.htm; # enable rewirte if (! -E $ request_filename) {rewrite ^/(. *)/index. php? R = $1 last ;}

Sincerely solve,

Reply content:

I wrote an interface using the path localhost/api/web/index. php? R = user/test
The code of actiontest is echo '123 ';
Configure urlmanager according to the tutorial on the internet. the code is as follows:

'Urlmanager' => ['enableprettyurl' => true, // beautify url = ture 'enablestrictparsing' => false, // strict parsing not enabled 'showscriptname' => false, // hide the index. php 'rules' => ['
  
   
/'=>'
   
    
/',],],
   
  

Then configure nginx rewrite

Listen 80;

Server_name localhost; location/{root D:/Github/Server/advanced; index. php index.html index.htm; # enable rewirte if (! -E $ request_filename) {rewrite ^/(. *)/index. php? R = $1 last ;}

Sincerely solve,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.