apache - .htaccess rewrite based on referrer -


i'd direct traffic coming particular domain (foo.net) homepage of website (http://www.bar.net/index.php). i've tried many, many ways of doing this, of crash site, others of don't work. however, can reliably direct google.com or bbc.com using following:

<ifmodule mod_rewrite.c>   options +followsymlinks   rewriteengine on   rewritecond %{http_referer} ^http://(www\.)?foo\.net   rewriterule ^$ http://www.bbc.com [l] </ifmodule> 

this current code:

<ifmodule mod_rewrite.c>   options +followsymlinks   rewriteengine on   rewritecond %{http_referer} ^http://(www\.)?foo\.net   rewriterule ^$ http://www.bar.net/index.php [l] </ifmodule> 

however, traffic comes via 1 link particular page on site http://www.bar.net/?q=en/tickets , when redirect own homepage, ?q=en/tickets appended url , visitor sent tickets page anyway (the url looks this: http://www.bar.net/index.php?q=en/tickets

it's drupal site .htaccess has other content, , i've put right @ beginning of .htaccess. feel need tweak here - ideas

add ? end of target url:

rewriterule ^$ http://www.bar.net/index.php? [l] 

or use [qsd] flag if you're on apache 2.4

rewriterule ^$ http://www.bar.net/index.php [l,qsd] 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -