需要顶级 301 重定向但子域与重定向同名?

Need Top Level 301 Redirect but subdomain has same name as redirect?

我有一个主站点,下面有多个子域: 所以: example.com 产品。example.com 书籍。example.com,等

我正在尝试创建如下重定向: RedirectMatch 301 ^/products/catalog/(.*) //products.example.com/$1 但这不起作用,因为 "products" 是 subdirectory/subdomain 所以它只是在 //products.example.com

处创建一个重定向循环
But This works (because /store isn't //store.example.com/)
RedirectMatch 301 ^/store/catalog/(.*) //products.example.com/ 

我尝试使用 rewritecond 进行试验,使其仅在 url 包含根域时才重定向,但这也不起作用。

如果页面如下: //products.example.com/products/great-thing.html 存在并且是安装在文件夹 "products" 中的主域下的子域(即 /public_html/products/...)

-- how would you redirect from:
//example.com/products/great-thing.html to 
//products.example.com/products/great-thing.html

我希望这是有道理的!

我应该补充一点,这个网站托管在一个托管的 cloud/vps - 所以他们的设置中很可能有一些东西导致了麻烦。

但在它的最后,当 folder/subdomain 存在同名时创建重定向似乎有问题...

这很难追踪,可能更多的是 processwire cms 问题,而不是直接的 apache 重定向问题,但如果它对某人有帮助,那么起作用的是:

顶级(即根域站点)需要 //示例。com/products/great-thing.html 到 //products.example.com/products/great-thing.html

RewriteRule ^(.)/products/(.) https://products.example.com/products/$2 [R=301,L]

应该去: https://products.example.com/products/great-thing.html ,而是创建了一个从未解决的循环。

但在子站点 (processwire) 上添加时它确实有效: 重写规则 ^products/(.*) ^/products/$1 [R=301,L]