Home > Backend Development > PHP Tutorial > The yii20 configuration is accessed in the form of pathinfo. PHP opens pathinfo. Apache pathinfo does not support pathinfo.

The yii20 configuration is accessed in the form of pathinfo. PHP opens pathinfo. Apache pathinfo does not support pathinfo.

WBOY
Release: 2016-07-29 08:54:58
Original
1029 people have browsed it

The default access form of yii2.0 is: dxr.com/index.php?r=index/list. Generally, we will configure it as 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:

'urlManager' => [

'enablePrettyUrl' => true,

'showScriptName' => false,

'rules' => [

],

],

windows pathinfo,php pathinfo,pathinfo开启,cgi.fix pathinfo,开启curl和pathinfo,nginx pathinfo,thinkphp pathinfo,pathinfo extension,url pathinfo depr,php pathinfo模式,curl和pathinfo,cgi.fix pathinfo 1,php开启pathinfo,apache pathinfo,不支持pathinfo

At this time, yii2.0 already supports access in the form of pathinfo. If Unable to access, continue reading.

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 in the nginx configuration file:

server {

listen 80;

server_name www.daixiaorui.com;

location / {

root E: /wwwroot/yii2.0;

index index.html index.php;

if (!-e $request_filename){

rewrite ^/(.*) /index.php last;

}

}

location ~ .php$ {

root                                                                                                        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.

The article comes from: http://www.daixiaorui.com/read/218.html All articles on this site are original unless the source is indicated. Please indicate the address of this article when reprinting. All rights reserved.

The above introduces the access of yii20 configuration in the form of pathinfo, including the content of pathinfo. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template