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

第一种方法:php

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

'URL_MODEL'  =>  2,       // URL访问模式,可选参数0、一、二、3,表明如下四种模式:

第二种方法:url

   使用Apache来进行设置spa

  1.打开配置文件httpd.conf     code

#LoadModule rewrite_module modules/mod_rewrite.so

    去掉前面的#htm

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

  

<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伪静态的实现it

 

 在你配置文件中修改便可io

  'URL_HTML_SUFFIX'       =>  'html|shtml',  // URL伪静态后缀设置
相关文章
相关标签/搜索