I'm having an a-hole of a problem redirecting traffic. Basically, I'm building a new web server and it's on another version of my domain, so I want to redirect traffic not from this IP.
Problem is Amazon's ELB Load Balancer is in the way, so it replaces REMOTE ip address. The normal method of obtaining. Research found I need to use %{X-Forward-For}i - but it's not working and I don't know if I've got it in the right placement and syntax. I'm running vhosts, so I put in the VirtualHost tags...
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/vhosts/foo/www.bar.com/htdocs/
ServerName www.bar.com
ErrorLog /var/www/vhosts/foo/www.bar.com/logs/error.log
CustomLog /var/www/vhosts/foo/www.bar.com/logs/access.log common
RewriteEngine On
RewriteCond %{X-Forwarded-For}i !^xxx\.xxx\.xxx\.xxx
RewriteRule ^.*$ http://www.bar.com/ [R,L]
</VirtualHost>
Obv xxx.xxx.xxx.xxx being my IP.
Is this wrong?
On the top of my head: shouldn't this
be
or just