【问题标题】:How to redirect just the sub dir and not the content?如何仅重定向子目录而不重定向内容?
【发布时间】:2013-02-22 20:26:21
【问题描述】:

我有以下设置:

http://example.com/foo/cake1.php
http://example.com/foo/cake2.php
http://example.com/foo/cake3.php

当我用户访问时:

http://example.com/foo

我想把它们寄到:

http://example.com

并保存

http://example.com/foo/cake[1-3].php

等等

我试过了:

Redirect /foo /

但这会重定向 foo 下的所有内容。我只想将 foo 重定向到根目录。我该怎么做?

【问题讨论】:

    标签: http-redirect


    【解决方案1】:

    终于想通了:

    RedirectMatch 301 ^/foo/$ /
    

    【讨论】:

      猜你喜欢
      • 2022-01-22
      • 1970-01-01
      • 2013-12-07
      • 1970-01-01
      • 1970-01-01
      • 2013-09-12
      • 2017-06-15
      • 2016-02-16
      • 1970-01-01
      相关资源
      最近更新 更多