1. 程式人生 > 程式設計 >phpstudy隱藏index.php的方法

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的方法

總結

到此這篇關於phpstudy隱藏index.php的方法的文章就介紹到這了,更多相關phpstudy隱藏index.php內容請搜尋我們以前的文章或繼續瀏覽下面的相關文章希望大家以後多多支援我們!