【问题标题】:How to set a specific default html/php document a directory如何设置特定的默认 html/php 文档目录
【发布时间】:2013-12-07 18:56:31
【问题描述】:

我的网站空间(“test”)上有一个目录,其中放置了文件 abc.php。当我在浏览器中输入以下 URL 时,应该加载文档: mywebspace.com/test/

我不想将其命名为 index.php,并且地址栏中应显示“mywebspace.com/test/”而不是(!)“mywebspace.com/test/abc.php”。

这可能吗?怎么做?

【问题讨论】:

  • 欢迎来到 Stackoverflow。我知道您是新手,但请记住,您的一些研究对帮助您有很长的路要走。到目前为止,您尝试过什么吗?请先展示您的努力,以便其他人可以帮助您。另外,请阅读FAQHow to Ask

标签: html file directory default


【解决方案1】:

如果你有一个名为 test 的目录,你可以编写这个.htaccess 文件:DirectoryIndex test/

<Files ~ "^\.(htaccess|htpasswd)$">
deny from all
</Files>
DirectoryIndex test/       
order deny,allow

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-04
    • 1970-01-01
    • 1970-01-01
    • 2019-02-19
    相关资源
    最近更新 更多