got_mod_rewrite()
Returns true if the Apache server is used with the mod_rewrite module loaded.
Hooks from the function
Returns
true|false.
Usage
got_mod_rewrite();
Examples
#1 Check if the Apache server is used with the mod_rewrite module loaded.
if ( got_mod_rewrite() ) {
// Used.
}
else {
// Not used.
}
Changelog
| Since 2.0.0 | Introduced. |
got_mod_rewrite() got mod rewrite code WP 6.9.1
function got_mod_rewrite() {
$got_rewrite = apache_mod_loaded( 'mod_rewrite', true );
/**
* Filters whether Apache and mod_rewrite are present.
*
* This filter was previously used to force URL rewriting for other servers,
* like nginx. Use the {@see 'got_url_rewrite'} filter in got_url_rewrite() instead.
*
* @since 2.5.0
*
* @see got_url_rewrite()
*
* @param bool $got_rewrite Whether Apache and mod_rewrite are present.
*/
return apply_filters( 'got_rewrite', $got_rewrite );
}