Detecting mod_rewrite via CGI

S

Samuel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top