【问题标题】:Htaccess - redirect 'file' from not existing directoryHtaccess - 从不存在的目录重定向“文件”
【发布时间】:2011-12-08 13:07:49
【问题描述】:

我想将不存在的文件重定向到我根目录中的 index.php,我的 htaccess 中有这个规则:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

这会将我 http://www.test.de/test.php 正确重定向到 index.php。

但是 http://www.test.de/test/test.php 不起作用。我可以从不存在的目录重定向文件吗?

感谢您的帮助。

【问题讨论】:

    标签: .htaccess redirect


    【解决方案1】:

    是的,你可以。 你可以测试这个:

    RewriteRule ^(.*)$ /index.php [L]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-28
      相关资源
      最近更新 更多