【问题标题】:Apache redirect directory to index.phpApache 将目录重定向到 index.php
【发布时间】:2012-08-30 11:14:35
【问题描述】:

我正在尝试将一个简单的文件夹重定向到 /folder/index.php。

我的 URL 如下所示:site.com/folder,我想要 site.com/folder/index.php。 通过网络,我只找到了相反的方式,但我确实想查看我的 index.php,以便以后可以使用 site.com/folder/index.php#344 之类的链接

我位于 /folder/ 中的 .htaccess 如下所示:

Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^/(.+)$ index.php
</IfModule>

当然它不起作用。 也许是 apache 忽略了我的文件?也许其他一些 .htaccess 正在干扰?我不知道,因为我是 apache 新手...

感谢您的帮助

【问题讨论】:

    标签: apache .htaccess redirect indexing


    【解决方案1】:

    你可以跳过这个 mod_rewrite 的东西并使用 mod_dir:

    DirectoryIndex index.php
    

    /folder 的htaccess 文件中,转到http://site.com/folder,您将获得index.php 的内容。

    【讨论】:

      猜你喜欢
      • 2013-04-10
      • 2012-04-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-12
      • 1970-01-01
      • 2013-03-06
      相关资源
      最近更新 更多