首页 > 解决方案 > 每个页面的子域重定向到主域

问题描述

我需要将子域页面重定向到主域上的新页面。重定向主页的最后一行中断了所有前一页重定向。它像这样重写它:

https://www.example.org/debt-help/do-debt-management-plans-work 

代替

https://example.org/get-out-of-debt/

但是只有当 #redirect 主页添加到 htaccess 时它才会中断

RewriteCond %{HTTP_HOST} ^debthelp\.example\.org [NC]
RewriteRule ^do-debt-management-plans-work/(.*)$ https://example.org/get-out-of-debt/$1 [L,R]

RewriteCond %{HTTP_HOST} ^debthelp\.example\.org [NC]
RewriteRule ^how-to-manage-your-debt/(.*)$ https://example.org/get-out-of-debt/$1 [L,R=301]

#redirect the homepage and 404s
RewriteCond %{HTTP_HOST} ^debthelp\.example\.org [NC]
RewriteRule ^(.*)$ https://example.org/debt-help/$1 [L,R]

它似乎在过去起作用。服务器设置是否会通过更新影响这一点?它也是一个运行 w3c 总缓存的 wordpress 站点。我们正在逐步淘汰多站点并将内容移至主站点。我不清楚 apache 文档。

标签: .htaccessmod-rewrite

解决方案


推荐阅读