yii2.0 Default Access form is: dxr.com/index.php?r=index/list, generally we will be configured to PathInfo form to access: dxr.com/index/list, so more in line with user habits.
The specific configuration method is:
One. Configure yii2.0.
Open the Config directory under web.php, and in $config = [' Components ' =>[add to this]], add:
' Urlmanager ' = [' enableprettyurl ' = ' = ', ' showscriptname ' = False, ' rules ' = [],],
At this point, yii2.0 has been supported in the form of pathinfo access, if not access at this time, continue to look down.
Two. Configure the Web server.
1. If Apache, create a new text file in the directory where the portal file (index.php) is located, then save As. htaccess, open this file with Notepad to join:
Rewriteengine Onrewritecond%{request_filename}!-frewritecond%{request_filename}!-dRewriteRule. index.php
Save it.
2. If it is nginx, add it in the Nginx config file:
server {listen ; server_name localhost; location/{root e:/wwwroot/yii2.0; index index.html index.php; 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.
This completes the configuration.