使用情境:我想输入www.abc.com/a/1后,实际上是跳转到www.abc.com/index.php/a/1

配置Nginx.conf在你的虚拟主机下添加:

location / {

     if (!-e $request_filename){

          rewrite ^/(.*)$ /index.php/$1 last;

     }

}

如果你的项目入口文件在一个子目录内,则:

location /目录/ {

     if (!-e $request_filename){

          rewrite ^/目录/(.*)$ /目录/index.php/$1 last;

     }

}

nginx去掉url中的index.php的更多相关文章

  1. CI在nginx环境下去掉url中的index.php

    在nginx环境下CI框架默认URL规则访问不了,出现500错误,如: http://blog.php230.com/index.php/keywords 今天在服务器配置CI框架环境时,去除URL中 ...

  2. nginx服务器去掉url中的index.php 和 配置path_info

    隐藏index.php server { listen 80; server_name yourdomain.com; root /home/yourdomain/www/; index index. ...

  3. CI去掉 URL 中的 index.php

    首先,你要清楚自己的 Web 服务器是 Apache,支持 mod_rewrite 查找httpd.conf中是否开启了mod_rewrite.so 然后,在 CI 根目录下新建立一个配置文件,命名为 ...

  4. ThinkPHP去掉URL中的index.php

    我的环境是apache+ubuntu 1,先确认你有没mod_rewrite.so模块 /usr/lib/apache2/modules/mod_rewrite.so 然后在httpd.conf最后一 ...

  5. ThinkPHP 隐藏URL中的 index.php

    去掉 URL 中的 index.php 通常的URL里面含有index.php,为了达到更好的SEO效果可能需要去掉URL里面的index.php ,通过URL重写的方式可以达到这种效果,通常需要服务 ...

  6. zencart分类页产品页去掉url中的id号

    最近公司新上的网站被seo指出要修改url,去掉url中产品id.由于我们用的是zencart框架,装了 Ultimate SEO URLs 插件,所以在网上应该有这方面的资料,本文主要参考资料: 原 ...

  7. Thinkphp中取消url中的index.php 和 Home 默认模块

    将配置文件中改: <?phpreturn array(    //'配置项'=>'配置值'    'URL_MODEL'=>'2',   //去掉url中index.php    ' ...

  8. Dedecms去掉URL中a目录的方法

    本文实例讲述了Dedecms去掉URL中a目录的方法.分享给大家,供大家参考.具体分析如下: 使用dedecms的朋友可能会发现自己的URL目录生成是会自动带有一个/A/目录了,那么要如何去掉URL中 ...

  9. Elasticsearch——禁止Body中的index覆盖Url中的index参数

    本篇继续一下Elasticsearch日常使用的技巧翻译. 在Elasticsearch有很多的api支持在body中指定_index等信息,比如mget或者msearch以及bulk. 默认的情况下 ...

随机推荐

  1. Uboot启动参数说明

    bootcmd=cp.b 0xc4200000 0x7fc0 0x200000 ; bootm // 倒计时到 0 以后,自动执行的指令 bootdelay=2 baudrate=38400 // 串 ...

  2. linux日常管理-rsync格式

    rsync支持网络到本地,本地到网络,本地到本地拷贝数据,支持增量拷贝.用作备份. man rsync rsync的两大用法.一种是通过shell,一种是deamon. shell  pull远程机器 ...

  3. HBase 二级索引与Coprocessor协处理器

    Coprocessor简介 (1)实现目的 HBase无法轻易建立“二级索引”: 执行求和.计数.排序等操作比较困难,必须通过MapReduce/Spark实现,对于简单的统计或聚合计算时,可能会因为 ...

  4. net.sf.json-lib maven依赖问题.

    <dependency> <groupId>net.sf.json-lib</groupId> <artifactId>json-lib</art ...

  5. servlet课堂笔记

    1.servlet生命周期: 1> 加载和实例化 2> 初始化 init() 3> 处理请求 service()->doGet()/doPost() 4> 销毁 dest ...

  6. viewstate的基本用法

    转自:http://www.cnblogs.com/ooip/p/4743536.html 在web窗体将控件属性设置为runat=server时,这个控件会被添加一个隐藏属性_ViewState,_ ...

  7. 第七篇 elasticsearch 链接mysql不会更新

    这是我键的索引 "settings":{ "number_of_shards":3, "number_of_replicas":2 }, & ...

  8. 对Json的一些理解

    标准json格式:{"name":"王大昭","url":"https://www.cnblogs.com/codezhao/&q ...

  9. IPMITOOL常用操作指令V1.0

    一.开关机,重启 1. 查看开关机状态: ipmitool -H (BMC的管理IP地址) -I lanplus -U (BMC登录用户名) -P (BMC 登录用户名的密码) power statu ...

  10. Ubuntu 安装 samba 实现文件共享和source insight 阅读uboot

    环境:win10 + 虚拟机Ubuntu 12.04 一. samba的安装: # sudo apt-get install samba # sudo apt-get install smbfs 二. ...