Reputation:
I'd like to direct all traffic coming from a particular domain (foo.net
) to the homepage of my website (http://www.bar.net/index.php
). I've tried many, many ways of doing this, some of which crash the site, others of which simply don't work. However, I can now reliably get it to direct to google.com
or bbc.com
using the following:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://(www\.)?foo\.net
RewriteRule ^$ http://www.bbc.com [L]
</IfModule>
This is the 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, nearly all the traffic comes via one link to a particular page on my site http://www.bar.net/?q=en/tickets
and when I redirect to my own homepage, ?q=en/tickets
is always appended to the URL and the visitor is sent to the tickets page anyway (the URL looks like this: http://www.bar.net/index.php?q=en/tickets
It's a Drupal site so the .htaccess
has other content, and I've put this right at the beginning of the .htaccess
. I feel I just need to tweak something here - any ideas
Upvotes: 0
Views: 1003
Reputation: 1655
Add a ?
to the 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]
Upvotes: 2