【问题标题】:Apache Redirect domain.com/dir/slug to sub.domain.com/dir/slug silently without .htaccessApache 将 domain.com/dir/slug 静默重定向到 sub.domain.com/dir/slug,无需 .htaccess
【发布时间】:2014-08-27 01:25:42
【问题描述】:

我正忙着想办法解决这个问题。

我在旧系统上有一个站点,它不允许我更改 domain.com 上的 .htaccess 文件。我已将此站点的一部分移至位于 sub.domain.com 的 WordPress 安装。我必须让 URL domain.com/dir/ 静默重定向到 sub.domain.com/dir/。我该怎么办?我可以编辑 domain.com 和 sub.domain.com 的 Apache 配置文件,以及 sub.domain.com 的 .htaccess,但不能编辑 domain.com 的 .htaccess

谢谢!

【问题讨论】:

    标签: apache .htaccess redirect subdomain subdirectory


    【解决方案1】:

    只需将重定向添加到 apache 配置文件中。在 domain.com 的虚拟主机中:

    Redirect 301 / http://sub.domain.com/
    

    如果通过“静默”(不确定这是什么意思,因为重定向涉及浏览器发送新请求),我猜你想反向代理?然后你需要确保 mod_proxy 已加载,然后执行:

    ProxyPass / http://sub.domain.com/
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-07-05
      • 1970-01-01
      • 2017-09-02
      • 1970-01-01
      • 2016-03-02
      • 1970-01-01
      • 2012-05-25
      相关资源
      最近更新 更多