【问题标题】:Apache - How to map a domain to specific path of another domain on the same host?Apache - 如何将域映射到同一主机上另一个域的特定路径?
【发布时间】:2018-10-01 16:15:20
【问题描述】:

我在example.com 之类的地址上有一个 Wordpress 网站,并且我想分别通过myshopdotcom.examplemyshopdotcom.example/products/sample-product 查看像example.com/shopexample.com/products/sample-product 这样的几个页面。

我知道编写一个简单的 301 重定向就可以完成这项工作,但我不想为 myshopdotcom.example 创建一个新的 Wordpress 站点,而是我想简单地将特定页面从 example.com 映射到 myshopdotcom.example

是否可以通过在VirtualHost 中写一些东西来实现?

【问题讨论】:

  • 您可以使用ServerAlias in VirtualHost 使所有页面出现在多个网站上。但是,如果您只想要一些,那就太宽泛了,但为什么不想要其他呢?如果有选择性,您需要两个VirtualHostProxyPass 之类的东西,除了正确配置的DNS 当然还有两个将这两个名称指向您的服务器。但是你在这里跑题了。

标签: wordpress apache dns virtualhost


【解决方案1】:

在 VirtualHost 中你可以使用 Alias 模块:

<ifModule alias_module>
        Alias "/phpmyadmin" "D:\WebServers\running\phpMyAdmin-4.6.6-english"
        Alias "/mpage1" "F:\folder\for\the\page"
        Alias "/mpage2" "/folder2/page2.html" #in linux
</ifModule>

有时您应该通过

授予对该文件的访问权限
<Directory "D:\WebServers\running\phpMyAdmin-4.6.6-english">
        Require all granted
</Directory>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-11-27
    • 1970-01-01
    • 1970-01-01
    • 2019-05-18
    • 2010-09-30
    • 2012-12-24
    • 2011-10-08
    相关资源
    最近更新 更多