Apache Mod Rewrite and PHP

Apache Mod Rewrite and PHP

By Shawn Olson

Posted on July 9th, 2009

If you need to test if an Apache server is running the mod_rewrite module, don't waste your time building some elaborate system or doing it manually. Learn from my mistake and do it the simple way with this PHP code:

if(in_array('mod_rewrite',apache_get_modules())){
//Apache has Mod Rewrite
} else {
//Apache DOES NOT have Mod Rewrite
}

 


Thanks Andrew! Too bad I didn't know about apache_get_modules() until after I had built something far more complex!

 

Copyright © 2009-2010 by Shawn Olson.

Subscribe to this guestbookComments on Apache Mod Rewrite and PHP

Andrew Penry said:

One note: apache_get_modules() may not be available in all PHP versions if apache is running in CGI mode instead of in module mode. Make sure to test it on your installation.

sitemap RGB Color Columbus Photography Free Word Search Maker monty hall game Hangman John Dewey