1.apache要开启pathinfo模式,需要在

<Directory />
Options +Indexes +FollowSymLinks +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
#AcceptPathInfo on   #增加这行配置
Require all granted
</Directory>

2.nginx增加pathinfo模式配置:

server {
listen 80;
server_name localhost;
root /data/app;
index index.htm index.html index.php default.php default.html;

#增加下面配置项

location / {

  if (!-e $request_filename){
    rewrite ^/(.*) /index.php last;
  }
  }

###########

location ~ \.php$ {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
}
}

关于url的pathinfo模式,要比普通的格式如http://localhost/index.php?a=2&b=3优雅,格式如:http://localhost/index.php/a/2/b/3

关于开启url的pathinfo模式的更多相关文章

  1. 用js拼接url为pathinfo模式

    用js拼接url为pathinfo模式

  2. [PHP] url的pathinfo模式加载不同控制器的实现

    使用自动加载和解析url的参数,实现调用到不同的控制器,实现了pathinfo模式和普通的url模式 文件结构: |--Controller |--Index |--Index.php |--Appl ...

  3. Nginx下配置ThinkPHP的URL Rewrite模式和pathinfo模式支持

    前面有关于lnmp环境的搭建,在此就不在赘述.下面就简述thinkPHP如何在nginx下开启url_rewrite和pathinfo模式支持 主要有两个步骤: 一.更改php.ini将;cgi.fi ...

  4. nginx完美支持thinkphp3.2.2(需配置URL_MODEL=>1 pathinfo模式)

    来源:http://www.thinkphp.cn/topic/26657.html 第一步:配置SERVER块 server { listen 80; server_name www.domain. ...

  5. ThinkPHP中pathinfo模式与URL重写

    Thinkphp中的pathinfo模式 http://serverName/appName/module/action/id/1/ pathinfo模式 在不考虑路由的情况下,第一个参数会被解析成模 ...

  6. ThinkPHP中的pathinfo模式和URL重写

    语文一直不太好,要我怎么解释这个pathinfo模式还真不知道怎么说,那就先来一段代码说下pathinfo模式吧 http://serverName/appName/module/action/id/ ...

  7. nginx 下开启pathinfo模式

    前几天自己新弄了个服务器,nginx的环境, 看到thinkcmf的框架,下载下来准备研究下,安装完成后,发现 url 是 普通模式,然后我就按照那个手册去后台开启了pathinfo模式,这一改完蛋了 ...

  8. nginx下开启pathinfo模式

    第一种方式是通过重写url来实现pathinfo模式: location / { if (!-e $request_filename){ rewrite ^/(.*)$ /index.php?s=/$ ...

  9. nginx 隐藏 index.php 和 开启 pathinfo 模式的配置

    nginx 通过 location 的规则匹配将 php 转发给 php-fpm 处理后获取结果然后返回给客户端,转发模式可以通过 unix sock 或 tcp socket 方式.百度了好多文章我 ...

随机推荐

  1. Python基础之字符串

    字符串内置处理函数 1.capitalize() 描述: 将字符串的第一个字母变成大写,其他字母变小写. 示例: a= "hello world" print (a.capital ...

  2. <poj - 2139> Six Degrees of Cowvin Bacon 最短路径问题 the cow have been making movies

    本题链接:http://poj.org/problem?id=2139 Description:     The cows have been making movies lately, so the ...

  3. Vim编辑器与Shell命令脚本

    章节简述: 本章节将教给您如何使用Vim编辑器来编写文档.配置主机名称.网卡参数以及yum仓库 ,熟练使用各个模式和命令快捷键. 我们可以通过Vim编辑器将Linux命令放入合适的逻辑测试语句(if. ...

  4. flex 4 datagrid 奇偶行颜色设置

    <s:DataGrid width="100%" height="100%" alternatingRowColors="[#ffFFff,#e ...

  5. linux 下执行.sh文件提示permission denied

    linux 下执行.sh文件提示permission denied 在脚本文件目录下运行命令,赋予权限: chmod 777 *.sh or chmod +x  *.sh

  6. GCD系列 之(二): 多核心的性能

    全局队列的并发执行 for(id obj in array) [self doSomethingIntensiveWith:obj]; 假设,每个元素要做的事情-doSomethingIntensiv ...

  7. JSON lib 里JsonConfig详解

    一,setCycleDetectionStrategy 防止自包含 /** * 这里测试如果含有自包含的时候需要CycleDetectionStrategy */ public static void ...

  8. javascript 日期对象

    1.日期对象定义 var Udate=new Date();//获得当前日期 2.Date对象中处理时间和日期的常用方法: 3.返回/设置年份 var mydate=new Date();//当前时间 ...

  9. scala调用外部命令

     scala调用外部命令 1.  导入sys.process包 2. 调用方式:" 外部命令 " !     双引号内+外部命令+感叹号 例:     scala调用外部命令工作原 ...

  10. ZZNU 1163: 在线判题(指针专题)

    题目描述 Ignatius is building an Online Judge, now he has worked out all the problems except the Judge S ...