location / { if (!-e $request_filename) { rewrite /admin/(.*)$ /admin.php/$1 last;//后台入口文件隐藏 rewrite /spe/(.*)$ /spe.php/$1 last;//其它模块的入口文件 rewrite ^(.*)$ /index.php?s=$1 last;//前台入口文件 break; } }
在apache环境中道理是一样的
<IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule /admin/(.*)$ admin.php?s=/$1 [QSA,PT,L] RewriteRule /spe/(.*)$ spe.php?s=/$1 [QSA,PT,L] RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L] SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0 </IfModule>