好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

ubuntuapache下隐藏thinkphp入口文件index.php

ubuntuapache下隐藏thinkphp入口文件index.php




按照thinkphp手册中来讲,apache服务器下,隐藏thinkphp入口文件有3步:
httpd.conf配置文件中加载了mod_rewrite.so模块 AllowOverride None 将None改为 All 把下面的内容保存为.htaccess文件放到应用入口文件的同级目录下:                                                          
mod_rewrite . c >
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/ $1 [QSA,PT,L]

ps:前两项在apache配置文件中
但在实际操作中发现几个问题 :
1 . 在ubuntu下没有httpd .conf配置文件,只有apache2 .con f,据说前者是用户自定义配置文件
2 .apache2.conf中没有 mod_rewrite.so ( windows中把配置文件中包含这行的代码注释去掉即可 完成配置)
解决办法:
    a.终端:a2enmod rewrite ,完成后重启服务器
    b.做启动链接(下次启动自动加载)(我在执行时提醒说已经存在了):
    ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load  
     重启服务器

赞赏码

非学,无以致疑;非问,无以广识

查看更多关于ubuntuapache下隐藏thinkphp入口文件index.php的详细内容...

  阅读:40次