apache配置rewrite规则,删除url中的index.php
来源:互联网 发布:js div 左右滑动 编辑:程序博客网 时间:2024/06/05 06:35
1,在httpd.conf文件中配置如下部分
<VirtualHost *:81>
DocumentRoot D:/Source/v5
</VirtualHost>
改成
<VirtualHost *:81>DocumentRoot D:/Source/v5 # Turn on URL rewritingRewriteEngine OnRewriteRule ^/app/(.*)$ /index.php/app/$1 [L,NC] RewriteRule ^/api/(.*)$ /index.php/api/$1 [L,NC] RewriteRule ^/open/(.*)$ /index.php/open/$1 [L,NC] RewriteRule ^/admin/(.*)$ /index.php/admin/$1 [L,NC] </VirtualHost>
RewriteRule ^/app/(.*)$ /index.php/app/$1 [L,NC]
意思将所有http://domain/app/controller 的url重写为 http://domain/index.php/app/controller。
L(last rule) 表明当前规则是最后一条规则,停止分析以后规则的重写。
NC(no case) 不区分大小写。
2,重写规则既可以在apache配置里写,还可以在kohana的.htaccess文件里写。
另外在项目目录下面的conf/routes.php中也可以配置url替换规则。
- apache配置rewrite规则,删除url中的index.php
- URL rewrite,Apache 伪静态规则配置
- Apache URL rewrite规则
- ThinkPHP 利用.htaccess文件的 Rewrite 规则隐藏URL中的 index.php
- ThinkPHP 利用.htaccess文件的 Rewrite 规则隐藏URL中的 index.php
- ThinkPHP 利用.htaccess文件的 Rewrite 规则隐藏URL中的 index.php
- ThinkPHP 利用.htaccess文件的 Rewrite 规则隐藏URL中的 index.php
- ThinkPHP 利用.htaccess文件的 Rewrite 规则隐藏URL中的 index.php
- 利用.htaccess文件的 Rewrite 规则隐藏URL中的 index.php
- Apache URL Rewrite配置(php 伪静态)
- Apache Url Rewrite 配置(php伪静态)
- php 伪静态(url rewrite)apache配置!
- php 伪静态(url rewrite)apache配置!
- php 伪静态(url rewrite)apache配置!
- apache服务器开启rewrite以及使用rewrite将thinkphp的url中index.php消除
- 在CodeIgniter删除URL中的index.php
- CI 框架(Apache环境)有效删除URL中的index.php
- apache之url rewrite(mod_rewrite)规则
- 利用DLL制作多语言版软件
- 什么是CPC,CPL,CPM,CPL,CPS,PPC...广告
- generic example
- Android学习札记三:初涉Service(1)之Context.startService()与Context.bindService()区别(转)
- Node入门
- apache配置rewrite规则,删除url中的index.php
- 文本模式 二进制模式& 文本文件 二进制文件
- Java:重写equals()和hashCode()
- Ubuntu下彻底卸载mysql
- Mediator模式(中介者)
- javascript正则表达式的贪婪模式与非贪婪模式对比
- 介绍一个小工具 Linqer
- 关于URLEncoder的编码和URLDecode解码
- C/C++中int/long/float/double数值类型与字符串互相转换[总结]