Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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 ^$ http://www.teetimelawncare\.com/lawncare\.html$1 [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.

share|improve this question
    
Have you checked apache's error_log? That should be your first step to get to the problem. –  vstm Sep 19 '13 at 7:52

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.