Detecting mod_rewrite via CGI
Samuel
knipknap at gmail.com
Thu Nov 29 14:49:02 EST 2007
Hi,
I am using an Apache webserver with mod_rewrite and the cgi module. Is
there a way to do the following that isn't completely evil?
########
def mod_rewrite_enabled():
try:
file = open(os.path.join(os.environ['DOCUMENT_ROOT'],
'.htaccess'))
except:
return False
for line in file:
if line.startswith('RewriteEngine on'):
file.close()
return True
file.close()
return False
########
Unfortunately, not using .htaccess isn't an option.
-Samuel
More information about the Python-list
mailing list