ThinkPHP去掉URL中的index.php
我的环境是apache+ubuntu
1,先确认你有没mod_rewrite.so模块
/usr/lib/apache2/modules/mod_rewrite.so
然后在httpd.conf最后一行加上(我不加也行,自己都奇怪)
LoadModule rewrite_module modules/mod_rewrite.so
重启
/etc/init.d/apache2 restart
2,将/etc/apache2/sites-enabled/000-default中的
AllowOverride None 将None改为 All
3,将TP的conf配置文件里写 'URL_MODEL' => '2'(开启REWRITE模式)
4,.htaccess文件必须放到项目根目录下,在文件里面添加
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
最后重启apache即可
ThinkPHP去掉URL中的index.php的更多相关文章
- ThinkPHP 隐藏URL中的 index.php
去掉 URL 中的 index.php 通常的URL里面含有index.php,为了达到更好的SEO效果可能需要去掉URL里面的index.php ,通过URL重写的方式可以达到这种效果,通常需要服务 ...
- CI在nginx环境下去掉url中的index.php
在nginx环境下CI框架默认URL规则访问不了,出现500错误,如: http://blog.php230.com/index.php/keywords 今天在服务器配置CI框架环境时,去除URL中 ...
- ThinkPHP去除url中的index.php
例如你的原路径是 http:.httpd.conf配置文件中加载了mod_rewrite.so模块 .AllowOverride None 讲None改为 All .确保URL_MODEL ...
- ThinkPHP -- 去除URL中的index.php
原路径是 http://localhost/test/index.php/index/add 想获得的地址是 http://localhost/test/index/add 那么如何去掉index.p ...
- thinkphp 去掉URL 里面的index.php
例如你的原路径是 http://localhost/test/index.php/home/goods/index.html 那么现在的地址是 http://localhost/test/home/g ...
- thinkphp 去掉URL 里面的index.php(?s=)
例如你的原路径是 http://localhost/test/index.php/home/goods/index.html 那么现在的地址是 http://localhost/test/home/g ...
- CI去掉 URL 中的 index.php
首先,你要清楚自己的 Web 服务器是 Apache,支持 mod_rewrite 查找httpd.conf中是否开启了mod_rewrite.so 然后,在 CI 根目录下新建立一个配置文件,命名为 ...
- nginx服务器去掉url中的index.php 和 配置path_info
隐藏index.php server { listen 80; server_name yourdomain.com; root /home/yourdomain/www/; index index. ...
- nginx去掉url中的index.php
使用情境:我想输入www.abc.com/a/1后,实际上是跳转到www.abc.com/index.php/a/1 配置Nginx.conf在你的虚拟主机下添加: location / { ...
随机推荐
- dsoframer控件学习小结(打开WORD,EXCEL等文件)
根据自己对dsoframer控件的学习,想把dsoframer控件进行简单的包装为C#的usercontrol,大体需要作如下:(创建windows的usercontrol的步骤就不再说了...)我们 ...
- Linux和UNIX监控
Linux和UNIX上的数据库监控工具包括监控CPU.内存.磁盘.网络.安全性和用户的监控工具.下面罗列了我们找到的有用工具及其简单描述. ps 显示系统上运行的进程列表 top ...
- Spark源码系列(四)图解作业生命周期
这一章我们探索了Spark作业的运行过程,但是没把整个过程描绘出来,好,跟着我走吧,let you know! 我们先回顾一下这个图,Driver Program是我们写的那个程序,它的核心是Spar ...
- Oracle数据库管理员面试题
Oracle数据库管理员面试题 1.模拟使用oracle的flashback找回过去某个时间点的数据,实现误操作的恢复. http://www.txw100.com/soft/2013/08/547. ...
- CSS3 页面跳转的动画效果
从左侧弹出: var windowWidth = window.innerWidth; $(atlas_list).css({ "transition":"none&qu ...
- SQL Server 数据库操作类
/// <summary> /// SQLServerHelper的摘要说明. /// </summary> public class SQLServerHelper { pu ...
- [LeetCode] Additive Number
Af first I read the title as "Addictive Number". Anyway, this problem can be solved elegan ...
- 开发常用到的terminal命令
1.删除work_plugin目录下的.svn文件(最后面的;也是命令的一部分) sudo find /Users/maxinliang/DaTang/work_plugin ".svn&q ...
- Android之输入框光标和Hint的位置
如图所示,要实现这一的需求,一般人的布局方式就是左边一button,右边一button,中间一个EditText,为了输入框的响应触摸范围更大往往不会把宽度设置为wrap_content,要么设置成m ...
- 【软件分析与挖掘】BOAT: An Experimental Platform for Researchers to Comparatively and Reproducibly Evaluate Bug Localization Techniques
摘要: 目前有许多的bug定位技术,但是,由于他们基于不同的数据集,而且有些数据集还不是公开的,甚至有些技术只应用于小数据集,不具有通用性,因此,不好比较这些技术之间的优劣. 因此,BOAT应运而生. ...