Forum Moderators: phranque
I assume the way to go about this is with a mod_rewrite statement in my htaccess file on xyz.example.com, but I'm not sure what the statement should be:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^xyz.example2.com [NC]
RewriteRule? [example.com...] [NC]
Any help would be greatly appreciated!
Thanks.
It looks like you are very close some simple 'tweeks' should get you there:
RewriteEngine On
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} ^xyz\.example2\.com [NC]
RewriteRule . [example.com...] [L]
The rule will now check any requested page. The first condition chacks to see if there is a referer present. If present, the referer will be checked against the second condition.
backslashing the .(dot) makes sure they are compared as .(dot) not 'any characted except a line break'
Overall you were very close, you might need to adjust for your specific situation, but this should be right about there.
Hope this helps.
Justin
Edited: can't type
RewriteCond %{HTTP_REFERER} ^(https?://)?xyz\.example2\.com [NC]
...to handle this eventuality. If you want to be REALLY pedantic:
RewriteCond %{HTTP_REFERER} ^(https?://)?xyz\.example2\.com[^.] [NC]
This ensures that you don't Rewrite requests coming from, say: [example.com.mx...] (You don't need to escape the '.' in a bracket expression; most special characters lose their special characteristics when placed within brackets. See your local regex man page for details).