# 伪静态配置
本节介绍部署过程中伪静态的配置
# Nginx
server {
listen 80;
server_name app.dev;
root D:/newfm/;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?r=$uri&$args;
}
location ~ .php$ {
try_files $uri =404;
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
}
}
TIP
try_files $uri $uri/ /index.php?r=$uri&$args;
规则中的?r= r
是可配置的分隔符通过var_pathinfo=>'r'
配置
# Apache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?r=/$1 [QSA,PT,L]
</IfModule>
TIP
RewriteRule ^(.*)$ index.php?r=/$1 [QSA,PT,L]
规则中的?r= r
是可配置的分隔符通过var_pathinfo=>'r'
配置