Check if Apache's mod_rewrite is installed.


/ Published in: PHP
Save to your folder(s)

*Example:*

if (!isRewriteMod()) exit('Please install Apache mod_rewrite module.');


Copy this code and paste it in your HTML
  1. /**
  2.  * @title Check if Apache's mod_rewrite is installed.
  3.  *
  4.  * @author Pierre-Henry Soria <[email protected]>
  5.  * @copyright (c) 2013, Pierre-Henry Soria. All Rights Reserved.
  6.  * @return boolean
  7.  */
  8. function isRewriteMod()
  9. {
  10. if (function_exists('apache_get_modules'))
  11. {
  12. $aMods = apache_get_modules();
  13. $bIsRewrite = in_array('mod_rewrite', $aMods);
  14. }
  15. else
  16. {
  17. $bIsRewrite = (strtolower(getenv('HTTP_MOD_REWRITE')) == 'on');
  18. }
  19.  
  20. return $bIsRewrite;
  21. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.