phpstudy隐藏index.php的方法

phpstudy如何隐藏index.php

找到打开 vhosts-ini

location / {
      **if (!-e $request_filename) {
        rewrite ^/(.*)$ /index.php/$1 last;
      }**

    index index.html index.htm index.php;
    #autoindex on;
  }

在配置文件中加入粗体!

PS:下面看下phpstudy 中使index.php文件优先于index.html

相信有很多人碰到在根目录同时存在index.html和index.php文件,目的是想默认直接走index.php文件,这个要怎么解决呢?

在phpstudy中有个快捷的设置,如下图,我用框圈起来的内容把index.php 放在最前面,我这个是改过之后的了。

phpstudy隐藏index.php的方法

有的朋友会说,那我是别的集成环境怎么办,或者不是集成环境,就是apache服务怎么解决,在Apache\conf\httpd.conf文件中,在251行,同理把index.php放在最前面。如果那行没有,搜索DirectoryIndex。

phpstudy隐藏index.php的方法

总结

相关推荐