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

来源:互联网 发布:php自动跳转页面 编辑:程序博客网 时间:2024/06/05 20:00

转载自http://www.cnblogs.com/libertycode/p/5935761.html

需要开启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.phpRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]</IfModule>
复制代码

 

4、重启服务器

service apache2 restart

 

0 0
原创粉丝点击