例如你的原路径是 http://localhost/test/index.php/home/goods/index.html

那么现在的地址是 http://localhost/test/home/goods/index.html 如何去掉index.php呢?

1.httpd.conf配置文件中加载了mod_rewrite.so模块  //在APACHE里面去配置 #LoadModule rewrite_module modules/mod_rewrite.so把前面的警号去掉

2.AllowOverride None 改None改为 All      //在APACHE里面去配置 (注意其他地方的AllowOverride也统统设置为ALL)

<Directory "D:/server/apache/cgi-bin">

  #AllowOverride none     
  AllowOverride ALL
  Options None
  Order allow,deny
  Allow from all
</Directory>

3.确保 config.php  里面配置项 URL_MODEL 设置为 2  return Array(    'URL_MODEL' => '2', );

4 .htaccess文件必须放到项目跟目录下 这个文件里面加:

<IfModule mod_rewrite.c>

  RewriteEngine on

  RewriteCond %{REQUEST_FILENAME} !-d

  RewriteCond %{REQUEST_FILENAME} !-f

  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

</IfModule>

详细见此文:

http://www.cnblogs.com/summerzi/p/3868566.html

thinkphp 去掉URL 里面的index.php的更多相关文章

  1. thinkphp 去掉URL 里面的index.php(?s=)

    例如你的原路径是 http://localhost/test/index.php/home/goods/index.html 那么现在的地址是 http://localhost/test/home/g ...

  2. 如何去掉wordpress网站url里面的index.php(Apache服务器)

    在wordpress根目录新建.htaccess文件,并拷贝以下代码保存即可. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase ...

  3. ThinkPHP去掉URL中的index.php

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

  4. angular 去掉url里面的#

    1.适合客户端的方法,但是页面不能刷新,一刷新就404 (1)在index.html里添加 <base href="/"> (2)在app.js的config里,注入$ ...

  5. ThinkPHP 隐藏URL中的 index.php

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

  6. ThinkPHP5 隐藏接口里面的index.php

    隐藏index.php 官方介绍是这样的:http://www.kancloud.cn/thinkphp/thinkphp5_quickstart/145250 可以去掉URL地址里面的入口文件ind ...

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

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

  8. ThinkPHP去除url中的index.php

    例如你的原路径是 http:.httpd.conf配置文件中加载了mod_rewrite.so模块  .AllowOverride None 讲None改为 All      .确保URL_MODEL ...

  9. ThinkPHP -- 去除URL中的index.php

    原路径是 http://localhost/test/index.php/index/add 想获得的地址是 http://localhost/test/index/add 那么如何去掉index.p ...

随机推荐

  1. shell入门基础必备

    作者:KornLee 2005-02-03 15:32:57 来自:Linux先生    1.建立和运行shell程序   什么是shell程序呢? 简单的说shell程序就是一个包含若干行 shel ...

  2. Python入门8文件处理

    文件处理文本模式name = input("请输入用户名:").strip()with open("a.txt","wt",encoding ...

  3. thinkphp5 composer安装验证码

    1,安装composer,选择安装到的php的版本.在使用phpstudy的时候 用的是php5.5 .注意phpstudy的安装路径. 2.检查composer是否安装成功.cmd 然后输入comp ...

  4. 缓冲区 粘包 029 send 和sendall 的区别 find 和 findall 的区别

    一.tcp : 属于长连接 与客户端连接了之后 其他客户端需要等待 要连接另外一个 必须优雅的断开前面这个客户的连接. 二.缓冲区 :为了避免网络传输信号不通畅而是程序一直停留在消息发送状态而不向下进 ...

  5. ubuntu php 连接sql server

    1.下载最新的freetds ,访问 http://www.freetds.org/, 或者在 ubuntu上用 wget ftp://ftp.freetds.org/pub/freetds/stab ...

  6. appium手机自动化环境搭建

    在robotframework环境安装完成的基础上进行如下安装,如果没有安装rfs环境,请先参考robotframework安装文章:Robot Framework的环境搭建 文件下载地址:链接:ht ...

  7. SpringBoot中使用Servlet

    1.在入口Application类上加入注解@ServletComponentScan @SpringBootApplication @ServletComponentScan public clas ...

  8. 用python处理时间、utf8文本、正则匹配、序列化、目录路径搜索、xml解析

    python 处理时间 import time import re now = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime()) ...

  9. vue router-link 添加在定义事件

    在vue学习中遇到给router-link 标签添加事件@click .@mouseover等无效的情况 我想要做的是v-for遍历出来的选项卡, 鼠标移上去出现删除标签,移除标签消失的效果 原代码: ...

  10. spring boot 配置redis

    先配置属性: # database name spring.redis.database=0 # server host spring.redis.host=127.0.0.1 # server pa ...