thinkphp框架 url 去除index.php

1.在apache配置文件 httpd.conf找到mod_rewrite.so ,去除前面的井号

2.在多站点配置文件中(httpd_vhosts.conf)修改None为All,重启apache

3.在项目根目录编写.htaccess文件内容为

  1. <IfModule mod_rewrite.c>
  2. RewriteEngine on
  3. RewriteCond %{REQUEST_FILENAME} !-d
  4. RewriteCond %{REQUEST_FILENAME} !-f
  5. RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
  6. </IfModule>

4.在项目应用配置文件中(Application/Common/Conf/config.php)写入

return array(

  'URL_MODEL'=>2  

);

配置完成.........

原文地址:https://www.cnblogs.com/kevinggk/p/8052883.html