.htaccess文件配置(去掉url里面的index.php)无效url后面加/
来源:互联网 发布:java log4j 使用教程 编辑:程序博客网 时间:2024/06/06 11:42
昨天把网站放到服务器(linux)上面了,之前是在本地的windows服务器上面运行的,配置的
<IfModule mod_rewrite.c>RewriteEngine OnRewriteCond %{HTTP_HOST} ^xxx.com$ [NC]RewriteRule ^index.php(.*)$ http://www.xxx/xxxi$1 [R=301,L] #R强制重定向,并且HTTP的相应码为302RewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]</IfModule>这个文件在本地的时候是生效的,会补全url也可以省去url里面的index.php,但是在移植到服务器上面之后,前面补全url的可以代码可以生效,但是后面省去index.php的代码不生效了,搞了半天,不知道怎么回事,后台把php的运行模式改成了apache模块模式运行(本来是fastcgi)就ok了,但是开始在本地的时候php就是以fastcgi模式运行的啊,为什么呢???
RewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_URI} !^(.*)\/$RewriteCond %{REQUEST_URI} !^(.*)(\.html)$RewriteRule ^(.*)$ http://www.xxx.com/xxx/$1/ [L,R=301]RewriteCond %{HTTP_HOST} ^xxx.com$ [NC]RewriteRule ^index.php(.*)$ http://www.xxx.com/xxx/$1 [R=301,L]RewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
url加上/
第一句,当请求的不是一个文件时(这个里面变量的和php全局变量SERVER里面的好像是一样的)
第二句,当请求的url不是以/结尾时
第三句,当请求的url不是以.html结尾时候
第四句,重定向到写的网址这个是正则匹配
再后面的就是省去index.php的操作了
0 0
- .htaccess文件配置(去掉url里面的index.php)无效url后面加/
- thinkphp 去掉URL 里面的index.php
- php 去掉Url里的 index.php
- CodeIgniter 的url中去掉index.php
- thinkphp5 去掉url里的index.php
- MVC中去掉index.php(优雅的使用url)
- CI框架 .htaccess 隐藏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
- ThinkPHP 利用.htaccess文件的 Rewrite 规则隐藏URL中的 index.php
- 利用.htaccess文件的 Rewrite 规则隐藏URL中的 index.php
- url中去掉index.php
- 去掉 URL 中的 index.php
- URL如何去掉index.php
- 去掉url 后面的jsessionid
- apache2.2.21下配置url地址重写 去掉index.php
- java mysql大数据量批量插入与流式读取分析
- AKKA快速入门
- UIAlertView的状态监视
- hdu2093考试排名(结构体)
- 利用数据文件恢复数据库
- .htaccess文件配置(去掉url里面的index.php)无效url后面加/
- 黑马程序员-iOS基础-C语言基础(五)指针
- FireFox调试代码(很强大)
- 【转】C# 串口编程详解
- tcpTrace的使用
- Hibernate之配置使用
- 致--2014年
- GitHub 上比较有意思的项目
- 中国手机面临专利风险:小米遭爱立信起诉