【问题标题】:Have WordPress with a different index file for testing让 WordPress 使用不同的索引文件进行测试
【发布时间】:2011-08-05 23:27:03
【问题描述】:

我正在为其设计网站的网站是使用静态 HTML 文件构建的。我正在将其转换为 WordPress,但我需要旧站点在 WordPress 安装在同一目录中时仍能正常运行(例如,将 index.html 设为默认站点,然后将 WordPress 设为 indexNew.php 之类的东西)

所以他们去http://domain.com/indexNew.php查看新网站的更新,直到它完成。

如何在 .htaccess 文件中配置它?

【问题讨论】:

    标签: wordpress .htaccess


    【解决方案1】:

    您可以使用带有简单规则的 .htaccess 将用户重定向到 index.html,但您除外:

    RewriteEngine on
    RewriteCond %{REQUEST_URI} !/index.html$
    RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123
    RewriteRule $ /index.html [R=302,L]
    

    将 123.123.123.123 替换为您的公共 IP 地址。

    【讨论】:

      【解决方案2】:

      您应该使用您的 .htaccess 设置默认文档顺序:

      厌倦了在访问 yoursite.com 时出现 yoursite.com/index.html?想要将其更改为出现的 yoursite.com/ILikePizzaSteve.html 吗?没问题!

      在您的情况下,您根本不需要重命名 index.php - 这可以解决问题:

      DirectoryIndex index.html index.php

      任何请求 yoursite.com 的人都会看到 index.html 中的内容。要查看新的 Wordpress 内容,只需导航到 yoursite.com/index.php

      【讨论】:

        猜你喜欢
        • 2014-05-06
        • 2019-03-24
        • 2014-06-22
        • 2020-02-15
        • 1970-01-01
        • 2017-12-04
        • 1970-01-01
        • 2016-03-13
        • 1970-01-01
        相关资源
        最近更新 更多