Ubuntu-server 下Apache2 配置.htaccess 隐藏thinkPHP项目index.php无效解决办法
来源:互联网 发布:淘宝店招怎么加收藏 编辑:程序博客网 时间:2024/06/01 08:58
最近在做一个thinkphp的项目,想隐藏掉index.php.
首先按照网上的资料修改apache配置以及添加.htaccess
需要开启Apache2的rewrite模块
1、打开/etc/apache2/apache2.conf
将文件中的AllowOverride None改为AllowOverride All
2、修改mods-enable配置,添加一个软件链接
cd /etc/apache2/mods-enableln -s ../mods-avaiable/rewrite.load rewrite.load
3、在项目根目录下添加.htaccess文件,修改rewrite规则
<IfModule mod_rewrite.c> RewriteEngine on #不显示index.php RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]</IfModule>
4、重启服务器
service apache2 restart
但是问题来了,添加好后,如果是windows就可以隐藏掉index.php了,但是在ubuntu下,还是不起作用。
原因如下:
1.在ubuntu下没有httpd.conf配置文件,只有apache2.conf,据说前者是用户自定义配置文件
2.apache2.conf中没有mod_rewrite.so(windows中把配置文件中包含这行的代码注释去掉即可完成配置)
解决办法:
a2enmod rewrite
完成后重启服务器
参考文献:http://www.cnblogs.com/libertycode/p/5935761.html
阅读全文
0 0
- Ubuntu-server 下Apache2 配置.htaccess 隐藏thinkPHP项目index.php无效解决办法
- Ubuntu Apache2 配置.htaccess 隐藏thinkPHP项目index.php无效正确解决办法!!!!!!
- Ubuntu-server 下Apache2 配置.htaccess 隐藏thinkPHP项目index.php
- 配置thinkphp路由,隐藏index.php
- ThinkPHP框架中隐藏index.php无效解决方法
- thinkphp 隐藏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
- ubuntu apache下设置隐藏index.php
- 在htaccess文件中隐藏index.php
- Thinkphp 隐藏 index.php 方法
- bae+ThinkPHP隐藏index.php
- thinkphp隐藏Index.php入口
- 关于ThinkPHP隐藏index.php
- thinkPHP Apache 优化url,隐藏index.php所需配置
- js 初始化日期对象 new Date() 常用方式
- ArrayList的四种遍历方法
- 【博客导读】
- 基于安卓平台,客户端视频监控的实现(一)
- MySQL 学习<十三> MySQL账户管理
- Ubuntu-server 下Apache2 配置.htaccess 隐藏thinkPHP项目index.php无效解决办法
- 正则表达式(基础)元字符含义
- javaweb学习总结(四十二)——Filter(过滤器)学习
- win10下tensorboard的使用
- thinkphp网页暂时无法连接,或已永久移动到了新网址
- [YTU]_2353 ( 长方柱类【C++ 类定义】)
- 深入理解 Java 虚拟机 Java内存区域与内存溢出异常
- 斯坦福机器学习之朴素贝叶斯
- 笔杆查重