2019独角兽企业重金招聘Python工程师标准>>>

一、apache服务器

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.确保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>
补充:在windows下不能建立以点开头的文件,你可以先随便建立一个文件

然后在DOS在操作 rename xxxx.xxxx   .htaccess

转载来源 地址: http://sjolzy.cn/ThinkPHP-remove-the-indexphp-url.html

二、IIS7.5服务器

1、windows 下的地址重写组件基本上都是收费或有限制,从windows server 2008开始官方提供了自己的重写组件,下载地址:http://www.iis.net/downloads/microsoft/url-rewrite。

规则文件要写在网站根目录的web.config中,重写规则可以由.htaccess导入过来,会变成web.config文件,

<?xml version="1.0" encoding="UTF-8"?>
<configuration><system.webServer><rewrite><rules><rule name="system" patternSyntax="ECMAScript"><match url="^.*system/(.*)$" ignoreCase="false" /><conditions logicalGrouping="MatchAll"><add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /><add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /></conditions><action type="Rewrite" url="/system/index.php?s={R:1}" appendQueryString="true" /></rule><rule name="auth" patternSyntax="ECMAScript"><match url="^.*auth/(.*)$" ignoreCase="false" /><conditions logicalGrouping="MatchAll"><add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /><add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /></conditions><action type="Rewrite" url="/auth/index.php?s={R:1}" appendQueryString="true" /></rule><rule name="main" stopProcessing="true"><match url="^(.*)$" ignoreCase="false" /><conditions logicalGrouping="MatchAll"><add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /><add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /></conditions><action type="Rewrite" url="index.php?s={R:1}" appendQueryString="true" /></rule></rules></rewrite><httpErrors errorMode="Detailed" /></system.webServer>
</configuration>

如上是简单的thinkphp的根目录跟子目录省去index.php的方法,这个实现在apache中简单多了,直接将.htaccess拷贝到根目录及各个子目录就可以了

<IfModule mod_rewrite.c>Options +FollowSymlinksRewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]
</IfModule>

2.打开官方下载地址,将页面拖到最底下,根据自己的需求选择相应的版本,有语言及32位、64位区分

3.双击同意协议安装

4.安装完成后,开始-管理工具-Internet 信息服务(IIS)管理器 即可找到URL重写模块,双击展开面板,可以看到相应的功能


转载于:https://my.oschina.net/u/1186749/blog/616575

ThinkPHP去除url中的index.php相关推荐

  1. u 去除index.php,ThinkPHP去除url中的index.php

    一.apache服务器 1.httpd.conf配置文件中加载了mod_rewrite.so模块  //在APACHE里面去配置 #LoadModule rewrite_module modules/ ...

  2. 易优cms 去除URL中的index.php Eyoucms快速入门

    针对不同服务器.虚拟空间,运行PHP的环境也有所不同,目前主要分为:Nginx.apache.IIS以及其他服务器.下面分享如何去掉URL上的index.php字符,记得在管理后台清除缓存,对于一些E ...

  3. 易优cms伪静态,EyouCms去除URL中的index.php

    针对不同服务器.虚拟空间,运行PHP的环境也有所不同,目前主要分为:Nginx.apache.IIS以及其他服务器.下面分享如何去掉URL上的index.php字符,记得在管理后台清除缓存,对于一些E ...

  4. cms访问index.php出错,易优Cms去除URL中的index.php

    针对不同服务器.虚拟空间,运行PHP的环境也有所不同,目前主要分为:Nginx.apache.IIS以及其他服务器.下面分享如何去掉URL上的index.php字符,记得在管理后台清除缓存,对于一些E ...

  5. thinkPHP 中去除URL中的index.php

    例如你的原路径是 http://localhost/app/index.php/module/action/var/value/ 那么现在的地址是 http://localhost/app/modul ...

  6. thinkphp url去掉index.php,thinkphp 去掉URL 里面的index.php(?s=)

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

  7. LNMP一键安装包+Thinkphp搭建基于pathinfo模式的路由(可以去除url中的.php)

    LNMP一键安装包是一个用Linux Shell编写的可以为CentOS/RadHat/Fedora.Debian/Ubuntu/Raspbian/Deepin VPS或独立主机安装LNMP(Ngin ...

  8. tp3 普通模式url模式_[tp3.2.1]开启URL(重写模式),省略URL中的index.php

    重写模式(省略url中的index.php) 在apache配置文件httpd.conf中,查找 1.mod_rewrite.so, 启动此模块 2.AllowOverride , 值= All 3. ...

  9. Vue.js项目去除url中的#/ - 解决篇

    文章目录 `Vue.js`项目`去除`url中的`#/` 一.解决办法 二.前后效果图,对比如下 Vue.js项目去除url中的#/ 使用vue路由,新建项目的url地址总是带有锚点#/,如下url: ...

  10. php 去掉url中的index.php,php 去掉url中的index.php

    php去掉url中的index.php的方法:首先打开相应的代码文件:然后将if代码块嵌套在server代码块中:最后重启nginx服务器即可. 本文操作环境:nginx1.0.4系统.PHP7.1版 ...

最新文章

  1. Oracle CEO狂妄而真实的演讲
  2. 自动备份网站和数据库打包并上传FTP服务器并删除前30天文件
  3. OpenStack从入门到放弃
  4. 获得网页中元素的位置
  5. (2环境架设)从零开始的嵌入式图像图像处理(PI+QT+OpenCV)实战演练
  6. 创建目录 java_java创建文件和目录
  7. pip 安装 pytorch环境
  8. 其实,我是靠怼产品上位的。。。
  9. 关于data.table中i, j, by都为数字的理解
  10. 山东大学软件学院2022数据化企业期末复习总结
  11. 【黑苹果】联想Lenovo ThinkPad E550+i55200U+macos10.13.x efi文件下载
  12. python选择题总结
  13. 关于ubuntu 系统chromium浏览器启用AdobeFlashPlayer
  14. php http请求 返回数据包太大 499,http错误码原理及复现 - 499,500,502,504
  15. linux常用命令-part3
  16. 云与瘦客户机 未来IT数据安全延续
  17. 如何开心愉快兴趣满满的学习机器人和人工智能知识并提升思维力
  18. 【XSY2495】余数
  19. 59 Three.js 渲染两个场景和使用不同的相机,渲染在一个场景里面
  20. 【高级篇 / FortiGate-VM】(6.4) ❀ 04. 虚拟 PC 通过 FortiGate VM 上网 ❀ FortiGate 防火墙

热门文章

  1. mysql闩_MySQL锁概述
  2. mc一进服务器就未响应,一进服务器就崩溃 大佬们求解
  3. 服务器接收不到信号,信号(SIGTERM)不被Windows上的subprocess接收
  4. 优品景象 进销存系统推荐_初步了解WMS(仓库管理系统)
  5. expert php and mysql_Expert PHP and Mysql
  6. CPT自定义按钮导出(含参)
  7. 查看工作日志Linux,工作日志,Linux的表现还是不错的
  8. android获得其他应用窗口,安卓一个程序调用其他程序的任一界面问题
  9. java lib_JavaLib
  10. 【Erlang开源项目】HTTP客户端ibrowse