phpGrace nginx伪静态配置

samool 发布暂无评论5872 阅读

AI摘要

本文介绍了phpGrace框架在nginx服务器上配置伪静态的方法。首先,提供了phpGrace默认为Apache配置的.htaccess文件内容。然后,详细说明了如何在nginx服务器上手动添加伪静态配置,包括server块的设置、location块的配置以及rewrite规则的应用。

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;
        }
    }
}
  1. 01phpgrace 定义json返回数据2020-03-06
  2. 02phpGrace 自带分页参数代码2020-03-05
  3. 03发现phpGrace工具实例化函数bug一枚2020-02-15
  4. 04PHP output_buffering的问题2019-12-26
  5. 05phpGrace会话机制如何将session放在redis里?2020-03-30
  6. 06PHP检测Emoji过滤Emoji2020-03-01
  7. 07PHP对HTML标签转义及反转义2020-02-16
  8. 08PHP爬虫工具phpquery中文手册2020-02-16
  9. 09PHP爬虫采集工具phpQuery的用法2020-02-16
  10. 10php字符串大小写转换2019-12-27
COMMENTS / 一纸留言

读者留言 0 条

一纸留言,便是山水间的一次相逢。

还没有留言,欢迎写下第一段交流。

WRITE A COMMENT

写下你的留言