是否可以通过htaccess或脚本将来自特定网址的用户重定向到另一个网址? (htaccess首选)
e.g。
用户来自www.domain-a.com/sample-site/到www.domain-b.net/sample-site2/,应该重定向到www.domain-c.org/sample3/ 不应仅从www.domain-a.com/sample-site /
重定向所有其他用户Domain-a和domain-b是wordpress网站。
感谢您的帮助
答案 0 :(得分:-1)
假设您可以控制domain-b.net:
RewriteEngine on
#If user clicks a link on a page sample-site of domain A
#which you may or may not control
RewriteCond %{HTTP_REFERER} ^http://(www.)?domain-a\.com/sample-site/? [NC]
#which aims at domain B, which you control, which runs this .htaccess file
RewriteCond %{HTTP_HOST} ^www.domain-b.net$
#requesting page sample-site2
RewriteCond %{REQUEST_URI} ^/?sample-site2/?
#then rewrite to domain C page sample3
RewriteRule ^ http://www.domain-c.org/sample3/ [R,L]