I am looking for an option to redirect user referred from a specific url (say abc.com) to domain.com/abc in Drupal 7
if http_referrer='abc.com' redirect to xyz.com/abc
I looked at Redirect, http response headers modules but need something for http_referrer.

Preferably without code modification.

  • Is it required to do this in code or can you use nginx/apache configuration to handle everything.
    – nvahalik
    Jan 13, 2017 at 20:49

1 Answer 1


You could add a redirect in the .htaccess file if you're using Apache. Something like this:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTP_REFERER} .*abc.com  [NC]
  RewriteRule .* http://example.com/abc  [R] 
  • Thanks @ponies. I should have been more specific, I have to do it without htaccess modification.
    – Sandeep
    Jan 16, 2017 at 14:17
  • @Sandeep Did you find a solution?
    – Shai
    Jun 6, 2019 at 13:37
  • 1
    @Shai I couldnt find a solution within Drupal but implemented thru javascript code.
    – Sandeep
    Jun 7, 2019 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.