Is it possible to redirect a user who is coming from a specific url to another url via htaccess or script? (htaccess prefered)
eg
user comes from www.domain-a.com/sample-site/ to www.domain-b.net/sample-site2/ and should be redirect to www.domain-c.org/sample3/ All other user shouldn't be redirected only the users from www.domain-a.com/sample-site/
Domain-a and domain-b are wordpress sites.
Thanks for the help
Assuming you have control over 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]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.