由于营销原因,我使用一些虚荣 URL 来进行更友好的访问,并跟踪一些活动。不幸的是,我被困在使用 cPanel 的托管专用服务器上,这些是我编写规则所采取的步骤:
- 首先,我在我的 cPanel 中添加了
xyz.com
和efg.com
停放的域 - 然后我写了
RewriteRule
我需要的所有s
.htaccess
RewriteCond %{HTTP_HOST} ^xyz\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.xyz\.com$
RewriteRule ^signdirections$ "http\:\/\/xyz\.abc\.com\/en?utm_source=signdirections&utm_medium=advert&utm_campaign=xyz" [R=301,L]
RewriteCond %{HTTP_HOST} ^efg\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.efg\.com$
RewriteRule ^signdirections$ "http\:\/\/efg\.abc\.com\/en?utm_source=signdirections&utm_medium=advert&utm_campaign=efg" [R=301,L]
现在,问题是如果我尝试访问www.efg.com/signdirections
,我将被重定向到该www.xyz.com/signredirections
版本,而不是 efg 的版本。
任何想法,为什么会这样?我的直觉是它检测到相同的主机名(HTTP_HOST),但我不明白为什么。