AI摘要
本文介绍了phpGrace框架在nginx服务器上配置伪静态的方法。首先,提供了phpGrace默认为Apache配置的.htaccess文件内容。然后,详细说明了如何在nginx服务器上手动添加伪静态配置,包括server块的设置、location块的配置以及rewrite规则的应用。
本文介绍了ph
phpGrace 默认已经为apache配置了伪静态规则文件.htaccess ,内容如下:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ ./index.php?pathInfo=$1 [QSA,PT,L]
</IfModule>
如果你的服务器是nginx的话,需要手动添加伪文件内容
server {
listen 80;
server_name www.phpgrace.com phpgrace.com;
root "D:/webs/www.phpgrace.com";
location /admin {
index index.html index.htm index.php;
if (!-e $request_filename){
rewrite ^/分组名称/(.*)$ /分组名称/index.php?pathInfo=$1;
}
}
location / {
index index.html index.htm index.php;
if (!-e $request_filename){
rewrite ^(.*)$ ./index.php?pathInfo=$1;
}
}
}