【问题标题】:Detecting folder content in URL not showing .php or .html检测 URL 中的文件夹内容未显示 .php 或 .html
【发布时间】:2014-06-01 02:36:33
【问题描述】:

如何使您的网址以这种格式显示?但仍然有两个可用的值。

例如,当我的客户点击“关于”页面的链接时,不会将他们带到文件夹的 index.php,而是自动检测文件夹的 .php 或 .html 并以这种格式在 URL 中显示。

http://www.example.com/about/

不是这样的:

http://www.example.com/about/index.php

有没有办法用 .htaccess 做到这一点

【问题讨论】:

    标签: php html .htaccess url


    【解决方案1】:

    通常,我们使用 DirectoryIndex s.t.

    DirectoryIndex index.html index.php
    

    在 .htaccess 或 httpd.conf 中。

    【讨论】:

    • 即使该文件不称为 index.php,这是否也有效?它可以在 about.php 上工作吗?
    猜你喜欢
    • 2011-02-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-23
    相关资源
    最近更新 更多