ThinkPHP下隐藏index.php以及URL伪静态

第一种方法:

设置url的重写模式(默认模式是1)

'URL_MODEL'  =>  2,       // URL访问模式,可选参数0、1、2、3,代表以下四种模式:

第二种方法:

   使用Apache来进行设置

  1.打开配置文件httpd.conf     

#LoadModule rewrite_module modules/mod_rewrite.so

    去掉前面的#

  2.在根目录index.php同级下新建一个.htaccess文件

  

<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

url伪静态的实现

 在你配置文件中修改即可

  'URL_HTML_SUFFIX'       =>  'html|shtml',  // URL伪静态后缀设置
原文地址:https://www.cnblogs.com/DemoLee/p/4219867.html