thinkphp消除URL中index.php的方法

来源:互联网 发布:大家都用阿里云做什么 编辑:程序博客网 时间:2024/04/30 10:10

每次部署到新环境都会忘记,在这里记录一下:

1、httpd.conf配置文件中加载了mod_rewrite.so模块 
2、AllowOverride None 将None改为 All 
3、conf/config.php中确保URL_MODEL设置为2 
4、在项目目录中把.htaccess 文件改成 
    <IfModule mod_rewrite.c> 
          RewriteEngine on 
          RewriteCond %{REQUEST_FILENAME} !-d 
  RewriteCond %{REQUEST_FILENAME} !-f 
  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] 
    </IfModule> 
重启Apache
http://<serverName>/index.php/Blog/read/id/1? 
就可以通过写成
http://<serverName>/Blog/read/id/1

0 0
原创粉丝点击