【问题标题】:htaccess rewrite index folder to php filehtaccess 将索引文件夹重写为 php 文件
【发布时间】:2012-04-14 17:53:54
【问题描述】:

这是我的文件夹结构

test
-.htaccess
-app
--index.php

我想当我去http://localhost/test/时,它重写为test/app/index.php(无重定向)

下面是我的 htaccess。现在它可以正常使用 url http://localhost/test/some/thing。使用 url http://localhost/test/,它仍然显示文件夹 test

的文件索引
<IfModule mod_rewrite.c>
RewriteBase /test/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /test/app/index.php [L]
</IfModule>

【问题讨论】:

    标签: php .htaccess


    【解决方案1】:

    重写规则用正则表达式表示,所以这不会使您的点成为任何字符匹配吗?你试过这个吗:

    RewriteRule ^/$ app/index.php [L]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-20
      • 2014-01-13
      • 2012-08-21
      • 2014-05-22
      • 2013-10-08
      • 1970-01-01
      相关资源
      最近更新 更多