I need help to create a code that redirects only users who came to my website from an url containing specific word, lets say for example "recipes". If the user comes to my website from a website that contains in the url the word recipes, then redirect to another another URL if not, nothing happens. The script must be using php or javascript but not htaccess rules.
Also I would appreciate if the redirection can use regular expression, for example mywebsite.com/post to website.net/post.