码迷,mamicode.com
首页 > 数据库 > 详细

Ubuntu-server 下Apache2 配置.htaccess 隐藏thinkPHP项目index.php

时间:2016-10-07 13:31:40      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:

需要开启Apache2的rewrite模块

1、打开/etc/apache2/apache2.conf

将文件中的AllowOverride None改为AllowOverride All

 

2、修改mods-enable配置,添加一个软件链接

cd /etc/apache2/mods-enable
ln -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

 

Ubuntu-server 下Apache2 配置.htaccess 隐藏thinkPHP项目index.php

标签:

原文地址:http://www.cnblogs.com/libertycode/p/5935761.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!