Mobile app version of vmapp.org
Login or Join
Gloria169

: What's wrong with my mod rewrite for GEOIP based on location? I'm a bit of a newb in modrewrite but used it successfully on my server before. I successful installed the module on my apache

@Gloria169

Posted in: #Geotargeting #ModRewrite #Redirects

I'm a bit of a newb in modrewrite but used it successfully on my server before.

I successful installed the module on my apache server and tested out with PHP test page(it correctly returned my area code) so I decided to test it out on a site and have it redirect to another page on it.

GeoIPEnable On
GeoIPDBFile /usr/local/share/GeoIP/GeoIP.dat Standard
GeoIPDBFile /usr/local/share/GeoIP/GeoLiteCity.dat Standard

RewriteEngine On
RewriteCond %{ENV:GEOIP_AREA_CODE} ^847
RewriteRule ^$ www.teetimelawncare.com/lawncare.html [NC,QSA]


I simply get 500 Internal Server Errors every single time. Any idea why?

EDIT: I was having errors with my AddType x-mapp php5 line in my .htaccess file. Removing that allows it to work.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Gloria169

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ann8826881

To isolate the problem, first try it without the redirect. If it still doesn't work, then make sure that the httpd user (e.g. nobody) has read access to the GeoIP database files, as covered in the Troubleshooting section here.

Also make sure that each line in your .htaccess file or main server config ends in a newline, and remove the spacing before RewriteEngine On.

Lastly, you might want to use IndexCache, which would reduce the number of lookups and read/write access for a large database file like GeoIP City - see the example here.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme