View Single Post
Old 05-14-2025, 03:57 PM  
AmateurFlix
Confirmed User
 
Industry Role:
Join Date: Jul 2004
Posts: 7,758
geo redirect question

I'm looking for ideas for a geo redirect solution.

I want to be able to redirect traffic from ~200 domains to one domain. I want to do this not by country but by state.

One of the server techs at my host has really gone above & beyond in his efforts to help me with this, but so far nothing has really been exactly what I need.

As it stands, he's created a solution where a geo ip database and state blacklist reside on a shared folder on the server so that all domains can access it. This is important because I don't want to edit 200 separate domains every time I need to add or drop a state.

His setup has every .php request being prepended with a call to go to a .php file that checks the user IP against the geo database and then either allows it to pass or redirects the request to a SFW domain.

This is perfect for the .php files; but it's not the .php files that I need redirected, it's the image files .jpg .png etc.

My only idea that would work with this setup is to .htaccess DENY FROM ALL the image folders then use the .php page to dynamically alter the .htaccess file and ALLOW FROM user ip's that did not trigger the redirect.

This is far from ideal because it's going to cause the .htaccess files to grow quite large, requiring periodic purging of the ALLOW FROM ip's, which requires keeping track of when they were added so I can purge them every hour or whatever. it's also going to require me to edit ~200 .php files and even more image folders across all of my domains to set up this elaborate scheme.

There must be a simpler way This seems like something better suited to a DNS level redirect rather than screwing around with each and every index.php and image folder on my system.

PS - one more wrench in the works; my servers reside in a state that will be redirected, so they need to be able to exempt their own IP's so that they may communicate with one another.
__________________
AmateurFlix is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote