【问题标题】:htaccess redirect a subdomain of a wordpress network site to a pagehtaccess 将 wordpress 网站的子域重定向到页面
【发布时间】:2012-12-31 15:23:01
【问题描述】:

我目前在 domain1.org 运行子域 WordPress 网络。子域站点之一是映射到 domain2.org 的域。我正在尝试向 domain2.org 添加一个子域,该子域将显示为 sample.domain2.org。问题是 domain2 指向 domain1。我们不使用通配符,我们手动编辑每个子域站点的 DNS(服务器管理规则)。尝试了类似Redirect 301 http://friend.episode13.org/ http://episode13.org/friend/ 的重定向规则

想法?

【问题讨论】:

    标签: wordpress .htaccess subdomain


    【解决方案1】:

    您需要为friend.episode13.org 设置一个虚拟主机,并在该虚拟主机中重定向到http://episode13.org/friend/

    Redirect 301 / http://episode13.org/friend/
    

    否则,您可以尝试使用mod_rewrite,并在friend.episode13.org子域指向的vhost(或文档根目录中的htaccess文件)中添加:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^friend\.episode13\.org$ [NC]
    RewriteRule ^/?(.*)$ http://episode13.org/friend/$1 [L,R=301]
    

    【讨论】:

    • 谢谢。我实际上能够弄清楚这一点,但我的解决方案完全相同,所以我标记了这个。
    猜你喜欢
    • 1970-01-01
    • 2021-09-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-24
    • 1970-01-01
    • 1970-01-01
    • 2016-10-26
    相关资源
    最近更新 更多