Question

I'm using GEO_IP to do a redirect and everything is working fine, however, instead of rerouting everything to a different domain, I would like to redirect to a certain webpage on the same domain. Problem then would be that I need to filter that page out, otherwise it would loop.

So.. say the file is called "welcome.html" and is in the root folder.. I want to reroute everything to welcome.html except when it's going to welcome.html.

Does this make sense?

So instead of:

RewriteCond %{ENV:GEOIP_CONTINENT_CODE} ^EU$ [NC]
RewriteRule ^ http://www.otherrdomain.com%{REQUEST_URI} [L,R]

I want to do make sure that one file is exempt and it should go to that file.. Would the following work?

RewriteCond %{ENV:GEOIP_CONTINENT_CODE} ^EU$ !^/welcome.html [NC]
RewriteRule ^(.*)$ /welcome.html [L,R]

I saw that last line in another post, but it would just be so totally different than what I had before (with the .* and all)... just wanted to run it by here..

Thanks for any input!

Was it helpful?

Solution

Changed it into:

RewriteCond %{ENV:GEOIP_CONTINENT_CODE} ^EU$ [NC]
RewriteCond %{REQUEST_URI} !^/welcome.html
RewriteRule ^(.*)$ /welcome.html [L,R]

Since I had a 500 Server Error before. This doesn't give a problem for anything outside the EU. EU people now have a "Page isn't redirecting properly"...

However, I found out that I got a "Page isn't redirecting properly", because it was still redirecting. If I simply made a static page 'welcome.html', then it works like a charm.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top