如何设置phpstudy使index.php不显示在浏览器地址栏?

更新于
2026-09-28 15:42:05
1阅读来源:SEO基础
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计263个文字,预计阅读时间需要2分钟。

如何设置phpstudy使index.php不显示在浏览器地址栏?

在PHPStudy中,要隐藏index.php并重定向请求,可以在vhosts.ini文件中的location块添加以下配置:

location / { **if (! -e $request_filename) { rewrite ^/(.*)$ /index.php?$1 last; }** index index. index.htm 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 放在最前面,我这个是改过之后的了。

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

总结

如何设置phpstudy使index.php不显示在浏览器地址栏?

到此这篇关于phpstudy隐藏index.php的方法的文章就介绍到这了,更多相关phpstudy隐藏index.php内容请搜索自由互联以前的文章或继续浏览下面的相关文章希望大家以后多多支持自由互联!

标签:方法PHP

本文共计263个文字,预计阅读时间需要2分钟。

如何设置phpstudy使index.php不显示在浏览器地址栏?

在PHPStudy中,要隐藏index.php并重定向请求,可以在vhosts.ini文件中的location块添加以下配置:

location / { **if (! -e $request_filename) { rewrite ^/(.*)$ /index.php?$1 last; }** index index. index.htm 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 放在最前面,我这个是改过之后的了。

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

总结

如何设置phpstudy使index.php不显示在浏览器地址栏?

到此这篇关于phpstudy隐藏index.php的方法的文章就介绍到这了,更多相关phpstudy隐藏index.php内容请搜索自由互联以前的文章或继续浏览下面的相关文章希望大家以后多多支持自由互联!

标签:方法PHP