Nginx伪静态配置

Apache下的配置为

# 将 RewriteEngine 模式打开
RewriteEngine On

RewriteBase /
# Rewrite 系统规则请勿修改
RewriteRule ^login(.*)$ index.php/api/login/index/(.*)$
RewriteRule ^ping(.*)$ index.php/api/ping/index/(.*)$
RewriteRule ^auth(.*)$ index.php/api/auth/index/(.*)$
RewriteRule ^portal(.*)$ index.php/api/user/index/(.*)$
RewriteRule ^library/test/success.html index.php/api/login/apple
RewriteRule ^weixin(.*)$   /index.php/api/login/weixin/(.*)$
RewriteRule ^dladmin(.*)$   /index.php/index/index/alog/(.*)$
RewriteRule ^ptadmin(.*)$   /index.php/wifiadmin/login/index/(.*)$

系统运行在Nginx下,所有规则不能公用;so改成如下即可:

<pre name="code" class="plain">       location / {
			rewrite ^(.*)login$ index.php/api/login/index/(.*)$2 last;
			rewrite ^(.*)ping$ index.php/api/ping/index/(.*)$2 last;
			rewrite ^(.*)auth$ index.php/api/auth/index/(.*)$2 last;
			rewrite ^(.*)portal$ index.php/api/user/index/(.*)$2 last;
			rewrite ^library/test/success.html index.php/api/login/apple last;
			rewrite ^(.*)weixin$   /index.php/api/login/weixin/(.*)$2 last;
			rewrite ^(.*)dladmin$   /index.php/index/index/alog/(.*)$2 last;
			rewrite ^(.*)ptadmin$   /index.php/wifiadmin/login/index/(.*)$2 last;
			#try_files $uri $uri/ /index.php$request_uri;
       }


 
 

你可能感兴趣的:(Nginx伪静态配置)