【问题标题】:How to rewrite (not redirect) homepage only to a sub directory如何仅将主页重写(不重定向)到子目录
【发布时间】:2016-06-28 10:38:56
【问题描述】:

我有一个安装了 2 个 wordpress 的网站。

/landing/* 
/blog/* 

/下的实际webroot基本是空的。

我希望像http://www.example.com 这样的主页提供/landing/ 下的内容我不希望它重定向。我希望浏览器中的 url 保持http://www.example.com 如果在该页面上点击了任何链接,他们只会转到普通页面 url,如http://www.example.com/landing/somepage

只是主页需要这样重写。

您如何使用 .htaccess 做到这一点?

【问题讨论】:

    标签: wordpress .htaccess


    【解决方案1】:

    您可以使用 DirectoryIndex 指令

    DirectoryIndex /landing
    

    这将在内部将您的主页重写为 /landing。

    【讨论】:

      【解决方案2】:

      你需要使用 DirectoryIndex

      【讨论】:

      • 请解释他们将如何使用它,以及它的作用,而不仅仅是评论。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-22
      • 1970-01-01
      • 1970-01-01
      • 2019-08-22
      • 1970-01-01
      相关资源
      最近更新 更多