yii2.0 is: dxr.com/index.php?r=index /list, generally we will configure it in the form of pathinfo to access: dxr.com/index/list, which is more in line with user habits.
The specific configuration method is:
1. Configure yii2.0.
Open web.php in the config directory and add:
in $config = [ 'components'=>[Add here] ]
'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => [ ], ],
At this time, yii2.0 already supports access in the form of pathinfo. If you cannot access it at this time, continue to read below.
2. Configure the web server.
1. If it is Apache, create a new text file in the directory where the entry file (index.php) is located, then save it as .htaccess, open this file with Notepad and add:
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php
Save it.
2. If it is nginx, add:
to the nginx configuration file
server { listen 80; server_name localhost; location / { root E:/wwwroot/yii2.0; index index.html index.php; if (!-e $request_filename){ rewrite ^/(.*) /index.php last; } } location ~ \.php$ { root E:/wwwroot/yii2.0; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
Three: Restart the web server.
At this point, the configuration is complete.